diff --git a/src/Player.java b/src/Player.java new file mode 100644 index 0000000000000000000000000000000000000000..e75ce25c2e6d44bfd62bc8acf6704413bf02bb88 --- /dev/null +++ b/src/Player.java @@ -0,0 +1,35 @@ +import bagel.Image; +import bagel.util.Point; +/** + * a movable entity: player + */ +public class Player{ + /** + * the player's image displayed in the window + */ + private final Image image; + /** + * render position of the player in the window + */ + private Point pos; + /** + * Player's current energy value + */ + private int energy; + /** + * constructor + * @param x abscissa + * @param y ordinate + */ + public Player(double x, double y,int energy) { + this.image = new Image("res/images/player.png"); + this.pos = new Point(x,y); + this.energy = energy; + } + /** + * draw player on the background + */ + public void draw() { + image.drawFromTopLeft(pos.x, pos.y); + } +} diff --git a/src/Sandwich.java b/src/Sandwich.java new file mode 100644 index 0000000000000000000000000000000000000000..fbcbf9854ec63572514f1026b8cd678594017f5c --- /dev/null +++ b/src/Sandwich.java @@ -0,0 +1,30 @@ +import bagel.Image; +import bagel.util.Point; +/** + * a stationary entity: sandwich + */ +public class Sandwich{ + /** + * the sandwich's image displayed in the window + */ + private Image image; + /** + * a Point object representing the position of the sandwich + */ + private Point pos; + /** + * constructor + * @param x abscissa + * @param y ordinate + */ + public Sandwich(double x, double y){ + this.image = new Image("res/images/sandwich.png"); + this.pos = new Point(x,y); + } + /** + * draw sandwich on the background + */ + public void draw() { + image.drawFromTopLeft(pos.x, pos.y); + } +} diff --git a/src/Zombie.java b/src/Zombie.java new file mode 100644 index 0000000000000000000000000000000000000000..98dc3cecd738079355841cdacccfe0a56d537214 --- /dev/null +++ b/src/Zombie.java @@ -0,0 +1,30 @@ +import bagel.Image; +import bagel.util.Point; +/** + * a stationary entity: zombie + */ +public class Zombie{ + /** + * the zombie's image displayed in the window + */ + private Image image; + /** + * a Point object representing the position of the zombie + */ + private Point pos; + /** + * constructor + * @param x abscissa + * @param y ordinate + */ + public Zombie(double x, double y){ + this.image = new Image("res/images/zombie.png"); + this.pos = new Point(x,y); + } + /** + * draw zombie on the background + */ + public void draw() { + image.drawFromTopLeft(pos.x, pos.y); + } +}