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:
parent
c716bc2187
commit
74ba66451b
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue