Restored the sprite
This commit is contained in:
parent
ef64874f36
commit
34decd72e4
1 changed files with 1 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue