package slimpleslickgame;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.ShapeFill;
import org.newdawn.slick.fills.GradientFill;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Vector2f;

public class Player {
	
	private Vector2f position;
	private Vector2f direction;
	private Shape shape;
	private ShapeFill shapeFill;
	
	public void init(){
		shape = new Rectangle(0, 0, 50, 50);
		shapeFill = new GradientFill(0,0, new Color(255, 0, 0), 50, 50, new Color(0, 0, 255), true);
		position = new Vector2f(50,300);
		direction = new Vector2f(0,0);
	}
	
	public void update(int delta){
		position.add(direction);
		shape.setLocation(position);
	}
	
	public void render(Graphics graphics){
		graphics.fill(shape, shapeFill);
	}

	public void setDirection(Vector2f dir) {
		this.direction = dir.normalise();
	}
	
}

@@ -866,16 +866,35 @@
  dir) %7B%0A
+%09%09dir.normalise();%0A
 %09%09this.d
@@ -904,32 +904,29 @@
 ction = dir.
-normalis
+scal
 e(
+5
 );%0A%09%7D%0A%09%0A%7D%0A

fix speed on 60fps