Leichte Vereinfachung an der Entity-Api.
This commit is contained in:
1 parent
4ebe78b848
commit
65a4d2a682
6 files changed
+44
-24
No files matched your search
@@ -1,5 +1,8 @@
|
||||
package de.teamteamteam.spacescooter.entity;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public abstract class Entity implements Updateable, Paintable {
|
||||
|
||||
/**
|
||||
@@ -7,6 +10,7 @@ public abstract class Entity implements Updateable, Paintable {
|
||||
*/
|
||||
protected int x;
|
||||
protected int y;
|
||||
private BufferedImage img;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -25,5 +29,20 @@ public abstract class Entity implements Updateable, Paintable {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public BufferedImage getImage() {
|
||||
return this.img;
|
||||
}
|
||||
|
||||
public void setImage(BufferedImage img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
g.drawImage(this.img, this.x, this.y, null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user