Restored the sprite

This commit is contained in:
Ziver Koc 2007-04-05 12:44:37 +00:00
parent ef64874f36
commit 34decd72e4

View file

@ -19,7 +19,6 @@ import ei.engine.texture.TextureLoader;
public class Sprite extends Entity {
/** The texture that stores the image for this sprite */
private Texture texture;
private Vector2f moveTo;
/**
* Create a new empty sprite
@ -77,29 +76,7 @@ public class Sprite extends Entity {
}
return texture.getImageHeight();
}
public void move(Vector2f vector) {
moveTo = vector;
}
public void update() {
if(moveTo!=null) {
if(moveTo.getX()>getLocation().getX()) {
getLocation().add(1.5f, 0f, 0f);
}
if(moveTo.getY()>getLocation().getY()) {
getLocation().add(0f, 1.5f, 0f);
}
if(moveTo.getX()<getLocation().getX()) {
getLocation().add(-1.5f, 0f, 0f);
}
if(moveTo.getY()<getLocation().getY()) {
getLocation().add(0f, -1.5f, 0f);
}
if(moveTo.getX()==getLocation().getX() && moveTo.getY()==getLocation().getY()) {
moveTo = null;
}
}
}
/**
* Returns the texture
* @return The texture