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.
This commit is contained in:
Jan Philipp Timme 2014-11-04 20:35:13 +01:00
parent c716bc2187
commit 74ba66451b
1 changed files with 2 additions and 0 deletions

View File

@ -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();
}