Started cleaing up the code

Game world objects no longer move (when paused) while the window is
being redrawn for resize events

Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-04-03 11:55:35 -04:00
parent 88b8853c31
commit 87eb6339e1
6 changed files with 150 additions and 145 deletions

View File

@@ -61,18 +61,22 @@ public class Display extends JPanel {
if(mText != null){
g.setColor(Color.ORANGE);
g.drawString(mText, this.getHeight() /2 , this.getWidth() / 2);
g.drawString(mText, this.getWidth() / 2, this.getHeight() /2 );
}
/*
* Move & Draw the world's objects
*/
Object item;
MovingSpaceObject mso;
for (int i = 0; i < mGame.getWorld().size(); i++) {
item = mGame.getWorld().get(i);
if (item instanceof MovingSpaceObject)
((MovingSpaceObject) item).move(getHeight(), getWidth());
if (item instanceof MovingSpaceObject){
mso = (MovingSpaceObject) item;
if(mso.isActive)
mso.move(getHeight(), getWidth());
}
if(item instanceof Drawable)
((Drawable) item).draw(g);