diff --git a/build.gradle b/build.gradle index 75c7c71038..62fce7581f 100644 --- a/build.gradle +++ b/build.gradle @@ -77,7 +77,8 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.Anuken:ucore:07fe3a5394' + //compile fileTree(dir: '../core/lib', include: '*.jar') + compile 'com.github.Anuken:ucore:b58e4bd' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index afff174c8b..9b4cb86d33 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -146,7 +146,7 @@ public class Control extends RendererModule{ smoothCamera(core.worldx(), core.worldy(), 0.4f); } - updateShake(); + updateShake(0.5f); float prevx = camera.position.x, prevy = camera.position.y; clampCamera(-tilesize / 2f, -tilesize / 2f, pixsize - tilesize / 2f, pixsize - tilesize / 2f); diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index 49dfcc4d79..4225a60cdd 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -40,27 +40,19 @@ public class UI extends SceneModule{ Dialog about, menu, restart, tutorial, levels, upgrades; Tooltip tooltip; - VisibilityProvider play = () -> { - return playing; - }; + VisibilityProvider play = () -> playing; - VisibilityProvider nplay = () -> { - return !playing; - }; + VisibilityProvider nplay = () -> !playing; public UI() { - Dialog.setShowAction(()->{ - return sequence(Actions.moveToAligned(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight(), Align.center), + Dialog.setShowAction(()-> sequence(Actions.moveToAligned(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight(), Align.center), parallel(Actions.moveToAligned(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2, Align.center, 0.09f, Interpolation.fade), - Actions.fadeIn(0.09f, Interpolation.fade))); - }); + Actions.fadeIn(0.09f, Interpolation.fade)))); - Dialog.setHideAction(()->{ - return sequence( + Dialog.setHideAction(()-> sequence( parallel(Actions.moveBy(0, -Gdx.graphics.getHeight()/2, 0.08f, Interpolation.fade), - Actions.fadeOut(0.08f, Interpolation.fade))); - }); + Actions.fadeOut(0.08f, Interpolation.fade)))); skin.font().setUseIntegerPositions(false); skin.font().getData().setScale(Vars.fontscale); @@ -301,9 +293,7 @@ public class UI extends SceneModule{ table.add().size(size); } - table.setVisible(()->{ - return button.isChecked(); - }); + table.setVisible(()-> button.isChecked()); stack.add(table); } @@ -355,21 +345,13 @@ public class UI extends SceneModule{ new table(){{ get().background("button"); - new label("Wave 1"){{ - get().setFontScale(fontscale*2f); - get().update(() -> { - get().setText("[YELLOW]Wave " + wave); - }); - }}.left(); + new label(()->"[YELLOW]Wave " + wave).scale(fontscale*2f).left(); row(); - new label("Time"){{ - get().update(() -> { - get().setText(enemies > 0 ? - enemies + " Enemies remaining" : "New wave in " + (int) (wavetime / 60f)); - }); - }}.minWidth(150); + new label(()->enemies > 0 ? + enemies + " Enemies remaining" : "New wave in " + (int) (wavetime / 60f)) + .minWidth(150); get().pad(Unit.dp.inPixels(12)); }}; @@ -379,7 +361,8 @@ public class UI extends SceneModule{ //if(Gdx.app.getType() != ApplicationType.Android){ - //+- table + //+- table + //TODO refactor to make this less messy new table(){{ aleft(); abottom(); diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index e4577bed3c..d53a98e675 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -28,6 +28,7 @@ public class Vars{ public static final int baseCameraScale = Math.round(Unit.dp.inPixels(4)); public static final int zoomScale = Math.round(Unit.dp.inPixels(1)); + public static int multiplier = android ? 2 : 1; public static final Vector2 vector = new Vector2(); public static final int tilesize = 8; diff --git a/core/src/io/anuke/mindustry/ai/Pathfind.java b/core/src/io/anuke/mindustry/ai/Pathfind.java index 7587a3306f..7dfe57027b 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfind.java +++ b/core/src/io/anuke/mindustry/ai/Pathfind.java @@ -10,7 +10,6 @@ import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.entities.Enemy; import io.anuke.mindustry.world.Tile; -import io.anuke.ucore.core.Effects; public class Pathfind{ static MHueristic heuristic = new MHueristic(); static PassTileGraph passgraph = new PassTileGraph(); @@ -77,10 +76,10 @@ public class Pathfind{ } - if(debug) - for(Tile tile : path){ - Effects.effect("ind", tile.worldx(), tile.worldy()); - } + //if(debug) + //for(Tile tile : path){ + // Effects.effect("ind", tile.worldx(), tile.worldy()); + //} } } diff --git a/core/src/io/anuke/mindustry/entities/Enemy.java b/core/src/io/anuke/mindustry/entities/Enemy.java index 22f24f4265..15943044b4 100644 --- a/core/src/io/anuke/mindustry/entities/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/Enemy.java @@ -54,7 +54,7 @@ public class Enemy extends DestructibleEntity{ } if(target != null){ - if(Timers.get(hashCode()+"reload", reload)){ + if(Timers.get(this, "reload", reload*Vars.multiplier)){ shoot(); Effects.sound(shootsound, this); } @@ -62,9 +62,9 @@ public class Enemy extends DestructibleEntity{ } public void shoot(){ - vector.set(length, 0).rotate(direction.angle()); - new Bullet(bullet, this, x+vector.x, y+vector.y, direction.angle()).add(); + Bullet out = new Bullet(bullet, this, x+vector.x, y+vector.y, direction.angle()).add(); + out.damage = bullet.damage*Vars.multiplier; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/Turret.java b/core/src/io/anuke/mindustry/world/blocks/Turret.java index 52881fff1d..15050e6072 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/Turret.java @@ -90,7 +90,7 @@ public class Turret extends Block{ if(enemy != null){ entity.rotation = MathUtils.lerpAngleDeg(entity.rotation, Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed - 0.1f), 0.2f); - float reload = Vars.android ? this.reload*2 : this.reload; + float reload = Vars.multiplier*this.reload; if(Timers.get(tile, reload)){ Effects.sound(shootsound, entity); shoot(tile); @@ -109,15 +109,13 @@ public class Turret extends Block{ TurretEntity entity = tile.entity(); vector.set(0, 4).setAngle(entity.rotation); - new Bullet(bullet, tile.entity, tile.worldx()+vector.x, tile.worldy()+vector.y, entity.rotation).add(); + Bullet out = new Bullet(bullet, tile.entity, tile.worldx()+vector.x, tile.worldy()+vector.y, entity.rotation).add(); + out.damage = bullet.damage*Vars.multiplier; } protected void bullet(Tile tile, float angle){ Bullet out = new Bullet(bullet, tile.entity, tile.worldx()+vector.x, tile.worldy()+vector.y, angle).add(); - - if(Vars.android){ - out.damage *= 2; - } + out.damage = bullet.damage*Vars.multiplier; } static class TurretEntity extends TileEntity{