experimental walk mode with space (axis-aligned)

v5stable
Ondřej Hruška 10 years ago
parent c94cd05da5
commit 233157a443
  1. 8
      src/mightypork/rogue/screens/ingame/WorldLayer.java
  2. 7
      src/mightypork/rogue/world/Player.java

@ -79,6 +79,14 @@ public class WorldLayer extends ScreenLayer {
w.getPlayer().walk(0, 1);
}
});
bindKey(new KeyStroke(true, Keys.SPACE), new Runnable() {
@Override
public void run()
{
w.getPlayer().walk(5, 5);
}
});
w.getPlayer().setTargetListener(new Runnable() {

@ -109,9 +109,14 @@ public class Player implements IonBundled, MapObserver, Updateable {
if (walkOffset.isFinished() && !target.equals(position)) {
int x = (target.x - position.x);
int y = (target.y - position.y);
if (Math.abs(x) >= Math.abs(y)) y = 0;
if (Math.abs(y) > Math.abs(x)) x = 0;
if (x > 0) x = 1;
if (x < 0) x = -1;
int y = (target.y - position.y);
if (y > 0) y = 1;
if (y < 0) y = -1;

Loading…
Cancel
Save