package slimpleslickgame;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Vector2f;

public class LocalPlayer extends Player{

	private GameContainer gc;
	
	public LocalPlayer(GameContainer gc){
		this.gc = gc;
	}
	
	@Override
	public void update(int delta) {
		processInput(gc.getInput());
		super.updatePosition();
	}
	
	private void processInput(Input input) {
		Vector2f direction = new Vector2f(0, 0);

		if (input.isKeyDown(Input.KEY_LEFT)) {
			direction.add(new Vector2f(-1, 0));
		}

		if (input.isKeyDown(Input.KEY_RIGHT)) {
			direction.add(new Vector2f(1, 0));
		}

		if (input.isKeyDown(Input.KEY_UP)) {
			direction.add(new Vector2f(0, -1));
		}

		if (input.isKeyDown(Input.KEY_DOWN)) {
			direction.add(new Vector2f(0, 1));
		}

		// TODO: add shooting capabilities

		super.setDirection(direction);
	}

}

@@ -379,20 +379,23 @@
 private 
-void
+boolean
  process
@@ -457,16 +457,46 @@
 f(0, 0);
+%0A%09%09boolean dirChanged = false;
 %0A%0A%09%09if (
@@ -561,32 +561,54 @@
 ctor2f(-1, 0));%0A
+%09%09%09dirChanged = true;%0A
 %09%09%7D%0A%0A%09%09if (input
@@ -672,24 +672,46 @@
 r2f(1, 0));%0A
+%09%09%09dirChanged = true;%0A
 %09%09%7D%0A%0A%09%09if (i
@@ -777,24 +777,46 @@
 2f(0, -1));%0A
+%09%09%09dirChanged = true;%0A
 %09%09%7D%0A%0A%09%09if (i
@@ -887,16 +887,38 @@
 0, 1));%0A
+%09%09%09dirChanged = true;%0A
 %09%09%7D%0A%0A%09%09/
@@ -952,16 +952,16 @@
 lities%0A%0A
-
 %09%09super.
@@ -985,14 +985,35 @@
 ction);%0A
+%09%09return dirChanged;%0A
 %09%7D%0A%0A%7D%0A

handle input fix