So, I made the choice of purely using the LWJGL for creating my games. After a week or so, I stumbled across 'Entities' – or game objects. After about half an hour I came up with an interface called Entity. The interface declares the following methods:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public interface Entity { public void draw(); public void update(int delta); public void setLocation(double x, double y); public void setX(double x); public void setY(double y); public double getX(); public double getY(); public double getWidth(); public double getHeight(); public void setWidth(double w); public void setHeight(double h); public boolean intersects(Entity e); } |
After I made this I created an abstract class called AbstractEntity, which basically implements everything but the draw method. For the intersects method I used the class java.awt.Rectangle, lazily initialized as a private instance variable using the width, height, x, and y variables.
My question is: will this code suffice for real use?
Thanks in advance,
TheCodingUniverse
EDIT: Please close this thread – my question has been answered.