Fixed scaling / Improved power node visuals / Balancing

This commit is contained in:
Anuken
2019-08-08 10:48:35 -04:00
parent e55575f093
commit c1ff370923
12 changed files with 69 additions and 37 deletions
Binary file not shown.
+9 -9
View File
@@ -160,14 +160,14 @@ public class Fx implements ContentList{
healWave = new Effect(22, e -> { healWave = new Effect(22, e -> {
Draw.color(Pal.heal); Draw.color(Pal.heal);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 30, 4f + e.finpow() * 60f); Lines.circle(e.x, e.y, 4f + e.finpow() * 60f);
Draw.color(); Draw.color();
}); });
heal = new Effect(11, e -> { heal = new Effect(11, e -> {
Draw.color(Pal.heal); Draw.color(Pal.heal);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 24, 2f + e.finpow() * 7f); Lines.circle(e.x, e.y, 2f + e.finpow() * 7f);
Draw.color(); Draw.color();
}); });
@@ -568,21 +568,21 @@ public class Fx implements ContentList{
nuclearShockwave = new Effect(10f, 200f, e -> { nuclearShockwave = new Effect(10f, 200f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 3f + 0.2f); Lines.stroke(e.fout() * 3f + 0.2f);
Lines.poly(e.x, e.y, 40, e.fin() * 140f); Lines.circle(e.x, e.y, e.fin() * 140f);
Draw.reset(); Draw.reset();
}); });
impactShockwave = new Effect(13f, 300f, e -> { impactShockwave = new Effect(13f, 300f, e -> {
Draw.color(Pal.lighterOrange, Color.LIGHT_GRAY, e.fin()); Draw.color(Pal.lighterOrange, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 4f + 0.2f); Lines.stroke(e.fout() * 4f + 0.2f);
Lines.poly(e.x, e.y, 60, e.fin() * 200f); Lines.circle(e.x, e.y, e.fin() * 200f);
Draw.reset(); Draw.reset();
}); });
spawnShockwave = new Effect(20f, 400f, e -> { spawnShockwave = new Effect(20f, 400f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 3f + 0.5f); Lines.stroke(e.fout() * 3f + 0.5f);
Lines.poly(e.x, e.y, 40, e.fin() * (e.rotation + 50f)); Lines.circle(e.x, e.y, e.fin() * (e.rotation + 50f));
Draw.reset(); Draw.reset();
}); });
@@ -614,7 +614,7 @@ public class Fx implements ContentList{
e.scaled(5 + intensity * 2, i -> { e.scaled(5 + intensity * 2, i -> {
Lines.stroke(3.1f * i.fout()); Lines.stroke(3.1f * i.fout());
Lines.poly(e.x, e.y, (int)(20 * intensity), (3f + i.fin() * 14f) * intensity); Lines.circle(e.x, e.y, (3f + i.fin() * 14f) * intensity);
}); });
Draw.color(Color.GRAY); Draw.color(Color.GRAY);
@@ -1157,21 +1157,21 @@ public class Fx implements ContentList{
launch = new Effect(28, e -> { launch = new Effect(28, e -> {
Draw.color(Pal.command); Draw.color(Pal.command);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f); Lines.circle(e.x, e.y, 4f + e.finpow() * 120f);
Draw.color(); Draw.color();
}); });
healWaveMend = new Effect(40, e -> { healWaveMend = new Effect(40, e -> {
Draw.color(e.color); Draw.color(e.color);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation); Lines.circle(e.x, e.y, e.finpow() * e.rotation);
Draw.color(); Draw.color();
}); });
overdriveWave = new Effect(50, e -> { overdriveWave = new Effect(50, e -> {
Draw.color(e.color); Draw.color(e.color);
Lines.stroke(e.fout() * 1f); Lines.stroke(e.fout() * 1f);
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation); Lines.circle(e.x, e.y, e.finpow() * e.rotation);
Draw.color(); Draw.color();
}); });
@@ -48,7 +48,6 @@ public class Renderer implements ApplicationListener{
if(settings.getBool("bloom")){ if(settings.getBool("bloom")){
setupBloom(); setupBloom();
} }
Lines.setCircleVertices(20);
Shaders.init(); Shaders.init();
Effects.setScreenShakeProvider((intensity, duration) -> { Effects.setScreenShakeProvider((intensity, duration) -> {
+1 -1
View File
@@ -140,7 +140,7 @@ public class UI implements ApplicationListener{
FreeTypeFontParameter outlined = new FreeTypeFontParameter(){{ FreeTypeFontParameter outlined = new FreeTypeFontParameter(){{
size = param.size; size = param.size;
borderColor = Color.DARK_GRAY; borderColor = Color.DARK_GRAY;
borderWidth = 2f; borderWidth = UnitScl.dp.scl(2f);
spaceX -= borderWidth; spaceX -= borderWidth;
incremental = true; incremental = true;
}}; }};
@@ -6,6 +6,7 @@ import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*; import io.anuke.arc.math.*;
import io.anuke.arc.math.geom.*; import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*; import io.anuke.arc.util.*;
import io.anuke.mindustry.content.*; import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.*;
@@ -402,7 +403,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
Core.scene.skin.getFont("outline").draw(item.amount + "", Core.scene.skin.getFont("outline").draw(item.amount + "",
x + Angles.trnsx(rotation + 180f, backTrns), x + Angles.trnsx(rotation + 180f, backTrns),
y + Angles.trnsy(rotation + 180f, backTrns) - 3, y + Angles.trnsy(rotation + 180f, backTrns) - 3,
Pal.accent, 0.25f * itemtime, false, Align.center Pal.accent, 0.25f * itemtime / UnitScl.dp.scl(1f), false, Align.center
); );
} }
} }
@@ -30,11 +30,11 @@ public enum Gamemode{
rules.pvp = true; rules.pvp = true;
rules.enemyCoreBuildRadius = 600f; rules.enemyCoreBuildRadius = 600f;
rules.respawnTime = 60 * 10; rules.respawnTime = 60 * 10;
rules.buildCostMultiplier = 0.5f; rules.buildCostMultiplier = 1f;
rules.buildSpeedMultiplier = 2f; rules.buildSpeedMultiplier = 1f;
rules.playerDamageMultiplier = 0.33f; rules.playerDamageMultiplier = 0.33f;
rules.playerHealthMultiplier = 0.5f; rules.playerHealthMultiplier = 0.5f;
rules.unitBuildSpeedMultiplier = 3f; rules.unitBuildSpeedMultiplier = 2f;
rules.unitHealthMultiplier = 3f; rules.unitHealthMultiplier = 3f;
rules.attackMode = true; rules.attackMode = true;
}, map -> map.teams.size > 1), }, map -> map.teams.size > 1),
@@ -21,14 +21,34 @@ public class Drawf{
} }
public static void circles(float x, float y, float rad, Color color){ public static void circles(float x, float y, float rad, Color color){
int vertices = (int)(rad * 2);
Lines.stroke(3f, Pal.gray); Lines.stroke(3f, Pal.gray);
Lines.poly(x, y, vertices, rad); Lines.circle(x, y, rad);
Lines.stroke(1f, color); Lines.stroke(1f, color);
Lines.poly(x, y, vertices, rad); Lines.circle(x, y, rad);
Draw.reset(); Draw.reset();
} }
public static void square(float x, float y, float radius, Color color){
Lines.stroke(3f, Pal.gray);
Lines.square(x, y, radius + 1f, 45);
Lines.stroke(1f, color);
Lines.square(x, y, radius + 1f, 45);
Draw.reset();
}
public static void square(float x, float y, float radius){
square(x, y, radius, Pal.accent);
}
/*
public static void square(float x, float y, float radius){
Lines.stroke(1f, Pal.gray);
Lines.square(x, y - 1f, radius + 1f, 45);
Lines.stroke(1f, Pal.accent);
Lines.square(x, y, radius + 1f, 45);
Draw.reset();
}*/
public static void arrow(float x, float y, float x2, float y2, float length, float radius){ public static void arrow(float x, float y, float x2, float y2, float length, float radius){
float angle = Angles.angle(x, y, x2, y2); float angle = Angles.angle(x, y, x2, y2);
float space = 2f; float space = 2f;
@@ -85,9 +85,9 @@ public class OverlayRenderer{
float dst = Mathf.dst(player.x, player.y, core.drawx(), core.drawy()); float dst = Mathf.dst(player.x, player.y, core.drawx(), core.drawy());
if(dst < state.rules.enemyCoreBuildRadius * 1.5f){ if(dst < state.rules.enemyCoreBuildRadius * 1.5f){
Draw.color(Color.DARK_GRAY); Draw.color(Color.DARK_GRAY);
Lines.poly(core.drawx(), core.drawy() - 2, 200, state.rules.enemyCoreBuildRadius); Lines.circle(core.drawx(), core.drawy() - 2, state.rules.enemyCoreBuildRadius);
Draw.color(Pal.accent, enemy.color, 0.5f + Mathf.absin(Time.time(), 10f, 0.5f)); Draw.color(Pal.accent, enemy.color, 0.5f + Mathf.absin(Time.time(), 10f, 0.5f));
Lines.poly(core.drawx(), core.drawy(), 200, state.rules.enemyCoreBuildRadius); Lines.circle(core.drawx(), core.drawy(), state.rules.enemyCoreBuildRadius);
} }
} }
} }
@@ -24,8 +24,8 @@ public class MirrorFilter extends GenerateFilter{
v1.trns(angle - 90, 1f); v1.trns(angle - 90, 1f);
v2.set(v1).scl(-1f); v2.set(v1).scl(-1f);
v1.add(in.width/2f, in.height/2f); v1.add(in.width/2f - 0.5f, in.height/2f - 0.5f);
v2.add(in.width/2f, in.height/2f); v2.add(in.width/2f - 0.5f, in.height/2f - 0.5f);
v3.set(in.x, in.y); v3.set(in.x, in.y);
+1 -1
View File
@@ -238,7 +238,7 @@ public class Block extends BlockStorage{
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
boolean ints = font.usesIntegerPositions(); boolean ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false); font.setUseIntegerPositions(false);
font.getData().setScale(1f / 4f); font.getData().setScale(1f / 4f / UnitScl.dp.scl(1f));
layout.setText(font, text); layout.setText(font, text);
float width = layout.width; float width = layout.width;
@@ -161,13 +161,12 @@ public class PowerNode extends PowerBlock{
Lines.stroke(1f); Lines.stroke(1f);
Draw.color(Pal.accent); Draw.color(Pal.accent);
Lines.poly(tile.drawx(), tile.drawy(), 50, laserRange * tilesize); Drawf.circles(tile.drawx(), tile.drawy(), laserRange * tilesize);
Draw.reset(); Draw.reset();
} }
@Override @Override
public void drawConfigure(Tile tile){ public void drawConfigure(Tile tile){
TileEntity entity = tile.entity();
Draw.color(Pal.accent); Draw.color(Pal.accent);
@@ -185,15 +184,9 @@ public class PowerNode extends PowerBlock{
if(link != tile && linkValid(tile, link, false)){ if(link != tile && linkValid(tile, link, false)){
boolean linked = linked(tile, link); boolean linked = linked(tile, link);
Draw.color(linked ? Pal.place : Pal.breakInvalid);
Lines.circle(link.drawx(), link.drawy(), if(linked){
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Time.time(), 4f, 1f))); Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 1f, Pal.place);
if((entity.power.links.size >= maxNodes || (link.block() instanceof PowerNode && link.entity.power.links.size >= ((PowerNode)link.block()).maxNodes)) && !linked){
Draw.color(Pal.breakInvalid);
Lines.lineAngleCenter(link.drawx(), link.drawy(), 45, link.block().size * Mathf.sqrt2 * tilesize * 0.9f);
Draw.color();
} }
} }
} }
@@ -204,9 +197,24 @@ public class PowerNode extends PowerBlock{
@Override @Override
public void drawPlace(int x, int y, int rotation, boolean valid){ public void drawPlace(int x, int y, int rotation, boolean valid){
Tile tile = world.tile(x, y);
if(tile == null) return;
Lines.stroke(1f); Lines.stroke(1f);
Draw.color(Pal.placing); Draw.color(Pal.placing);
Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize); Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize);
for(int cx = (int)(x - laserRange - 1); cx <= x + laserRange + 1; cx++){
for(int cy = (int)(y - laserRange - 1); cy <= y + laserRange + 1; cy++){
Tile link = world.ltile(cx, cy);
if(link != null && !(link.x == x && link.y == y) && link.block().hasPower && overlaps(x * tilesize + offset(), y *tilesize + offset(), link, laserRange * tilesize)){
Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 2f, link.pos() == lastPlaced ? Pal.place : Pal.accent);
}
}
}
Draw.reset(); Draw.reset();
} }
@@ -246,8 +254,12 @@ public class PowerNode extends PowerBlock{
return false; return false;
} }
protected boolean overlaps(float srcx, float srcy, Tile other, float range){
return Intersector.overlaps(Tmp.cr1.set(srcx, srcy, range), other.getHitbox(Tmp.r1));
}
protected boolean overlaps(Tile src, Tile other, float range){ protected boolean overlaps(Tile src, Tile other, float range){
return Intersector.overlaps(Tmp.cr1.set(src.drawx(), src.drawy(), range), other.getHitbox(Tmp.r1)); return overlaps(src.drawx(), src.drawy(), other, range);
} }
protected void drawLaser(Tile tile, Tile target){ protected void drawLaser(Tile tile, Tile target){
@@ -1,19 +1,19 @@
package io.anuke.mindustry.desktopsdl; package io.anuke.mindustry.desktopsdl;
import io.anuke.arc.Files.*; import io.anuke.arc.Files.*;
import io.anuke.arc.backends.sdl.*; import io.anuke.arc.backends.sdl.*;
import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.*;
import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.core.*;
import io.anuke.mindustry.net.*; import io.anuke.mindustry.net.*;
public class DesktopLauncher{ public class DesktopLauncher{
public static void main(String[] arg){ public static void main(String[] arg){
try{ try{
Platform.instance = new DesktopPlatform(arg); Platform.instance = new DesktopPlatform(arg);
Net.setClientProvider(new ArcNetClient()); Net.setClientProvider(new ArcNetClient());
Net.setServerProvider(new ArcNetServer()); Net.setServerProvider(new ArcNetServer());
new SdlApplication(new Mindustry(), new SdlConfig(){{ new SdlApplication(new Mindustry(), new SdlConfig(){{
title = "Mindustry"; title = "Mindustry";
maximized = true; maximized = true;