Skip to content

Commit

Permalink
add source code
Browse files Browse the repository at this point in the history
  • Loading branch information
mahditeymoorianar committed Dec 16, 2021
1 parent 4f8e2f5 commit 9dadf7c
Show file tree
Hide file tree
Showing 91 changed files with 4,289 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/GameObjects/Collectable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package GameObjects;

public class Collectable extends GameObject {
public boolean isCollected = false;
private static int sensitivity = 0;
private static int difficulty = 10;
public boolean doesCollect(Packman packman) {
if (isCollected) {return false;}
if ((packman.x >= this.x - size + difficulty && packman.x <= this.x + size - difficulty) &&
(packman.y >= this.y - size + difficulty && packman.y <= this.y + size - difficulty)) {
if (!isCollected) {
action();
}
isCollected = true;
this.initializeImage("none");
return true;
}
return false;
}

public void action() {
}
}
26 changes: 26 additions & 0 deletions src/main/java/GameObjects/Energy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package GameObjects;

import javafx.scene.control.Label;

public class Energy extends Collectable {
Packman packman;
Label label;

public void setLabel(Label label) {
this.label = label;
}

public Energy(Packman packman) {
this.packman = packman;
initializeImage("book");
}

public void setPackman(Packman packman) {
this.packman = packman;
}

public void action () {
packman.setSecured();
initializeImage("none");
}
}
8 changes: 8 additions & 0 deletions src/main/java/GameObjects/Food.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package GameObjects;

public class Food extends Collectable {

public Food() {
initializeImage("food");
}
}
Loading

0 comments on commit 9dadf7c

Please sign in to comment.