diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index f0385b9471..2e2b906e23 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -309,6 +309,10 @@ public class Control extends RendererModule{ if(Inputs.keyDown(Keys.SPACE)){ Effects.shake(6, 4); } + + if(Inputs.keyDown(Keys.Y)){ + new TestEnemy(0).set(player.x, player.y).add(); + } } if(GameState.is(State.menu)){ diff --git a/core/src/io/anuke/mindustry/Inventory.java b/core/src/io/anuke/mindustry/Inventory.java index 5f7667d491..a7c82e4364 100644 --- a/core/src/io/anuke/mindustry/Inventory.java +++ b/core/src/io/anuke/mindustry/Inventory.java @@ -17,7 +17,7 @@ public class Inventory{ if(debug){ items.put(Item.stone, 2000); - items.put(Item.iron, 1); + items.put(Item.iron, 2000); items.put(Item.steel, 2000); items.put(Item.coal, 2000); } diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index fc4749246d..3612ce47c4 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -12,6 +12,7 @@ import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.entities.*; +import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Timers; public class Enemy extends DestructibleEntity{ @@ -122,11 +123,11 @@ public class Enemy extends DestructibleEntity{ move(); - xvelocity = x - lastx; - yvelocity = y - lasty; + xvelocity = (x - lastx) / Mathf.delta(); + yvelocity = (y - lasty) / Mathf.delta(); if(target == null){ - direction.add(xvelocity, yvelocity); + direction.add(xvelocity * Mathf.delta(), yvelocity * Mathf.delta()); direction.limit(speed*rotatespeed); }else{ float angle = angleTo(target); diff --git a/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java new file mode 100644 index 0000000000..1472577371 --- /dev/null +++ b/core/src/io/anuke/mindustry/entities/enemies/TestEnemy.java @@ -0,0 +1,22 @@ +package io.anuke.mindustry.entities.enemies; + +import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Timers; + +public class TestEnemy extends Enemy{ + boolean dir = false; + + public TestEnemy(int spawn) { + super(spawn); + maxhealth = 99999; + heal(); + } + + void move(){ + if(Timers.get(this, "asd", 300)){ + dir = !dir; + } + + move(dir ? -0.3f * Mathf.delta() : 0.3f * Mathf.delta(), 0); + } +} diff --git a/core/src/io/anuke/mindustry/ui/LevelDialog.java b/core/src/io/anuke/mindustry/ui/LevelDialog.java index 873bc7378a..bcbf87997b 100644 --- a/core/src/io/anuke/mindustry/ui/LevelDialog.java +++ b/core/src/io/anuke/mindustry/ui/LevelDialog.java @@ -31,6 +31,7 @@ public class LevelDialog extends Dialog{ hide(); Vars.ui.showLoading(); Timers.run(16, ()->{ + Vars.control.reset(); World.loadMap(selectedMap); Vars.control.play(); }); diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index d18302d537..1b55a223e9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -98,7 +98,7 @@ public class ProductionBlocks{ int dir = source.relativeTo(tile.x, tile.y); dir = (dir+4)%4; Tile to = tile.getNearby()[dir]; - Timers.run(15, ()->{ + Timers.run(10, ()->{ to.block().handleItem(to, item, tile); }); @@ -109,7 +109,7 @@ public class ProductionBlocks{ int dir = source.relativeTo(dest.x, dest.y); dir = (dir+4)%4; Tile to = dest.getNearby()[dir]; - return to != null && to.block() != junction && to.block().accept(item, dest, to); + return to != null && to.block() != junction && to.block().accept(item, to, dest); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/Turret.java b/core/src/io/anuke/mindustry/world/blocks/Turret.java index 22e9c9a92c..e859e407fb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/Turret.java @@ -62,25 +62,6 @@ public class Turret extends Block{ Renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 13, fract); } - @Override - public void drawOverlay(Tile tile){ - /* - TurretEntity entity = tile.entity(); - - if(entity.ammo <= 0 && ammo != null){ - Draw.tcolor(Color.SCARLET); - Draw.tscl(1 / 8f); - //Draw.text("No ammo!", tile.worldx(), tile.worldy() + tilesize); - }else if(ammo != null){ - Draw.tscl(1 / 8f); - Draw.tcolor(Color.GREEN); - //Draw.text("Ammo: " + entity.ammo, tile.worldx(), tile.worldy() - tilesize); - } - - Draw.tscl(Vars.fontscale); - */ - } - @Override public boolean accept(Item item, Tile dest, Tile source){ return item == ammo && dest.entity().ammo < maxammo; @@ -107,7 +88,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), + Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed), 0.2f*Mathf.delta()); float reload = Vars.multiplier*this.reload; if(Timers.get(tile, reload)){ diff --git a/desktop/gifexport/recording1505164662.gif b/desktop/gifexport/recording1505164662.gif new file mode 100644 index 0000000000..1c557a2351 Binary files /dev/null and b/desktop/gifexport/recording1505164662.gif differ