Entity-Api durchstrukturiert und an GameScreen gekoppelt.

This commit is contained in:
JPT committed 2014-10-28 14:58:19 +01:00
1 parent a9bbc264eb
commit 4ebe78b848
17 files changed
+217 -93

No files matched your search

@@ -1,24 +1,29 @@
package de.teamteamteam.spacescooter.entity;
import java.util.ArrayList;
public abstract class Entity implements Updateable, Paintable {
public static ArrayList<Entity> entities = null;
/**
* We need to initialize the ArrayList, so the EntityUpdateThread won't beat us.
* Entity position
*/
static {
Entity.entities = new ArrayList<Entity>();
}
protected int x;
protected int y;
/**
* Constructor.
* All entities are within a static array list for our convenience.
*/
public Entity() {
Entity.entities.add(this);
public Entity(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
}