experimental walk mode with space (axis-aligned)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user