From 74ba66451bb38124cdff56d8064fc9524f0f4202 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 20:35:13 +0100 Subject: [PATCH] Entities without image now have 0x0 dimensions. Maybe this is just an ugly hack until we move the setImage() part into the constructor call to make sure every Entity _HAS_ an image before updating and painting occurs. --- src/de/teamteamteam/spacescooter/entity/Entity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/de/teamteamteam/spacescooter/entity/Entity.java b/src/de/teamteamteam/spacescooter/entity/Entity.java index 35dd1bd..4bc25ae 100644 --- a/src/de/teamteamteam/spacescooter/entity/Entity.java +++ b/src/de/teamteamteam/spacescooter/entity/Entity.java @@ -36,10 +36,12 @@ public abstract class Entity implements Updateable, Paintable { } public int getWidth() { + if(this.img == null) return 0; //no image -> nothing visible -> no width return this.img.getWidth(); } public int getHeight() { + if(this.img == null) return 0; //no image -> nothing visible -> no height return this.img.getHeight(); }