-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
518276c
commit ddcafe5
Showing
9 changed files
with
293 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
# <p align="center">PacMan</p> | ||
|
||
<p align="center"> | ||
<img width="400" src="https://i.postimg.cc/4NVj019y/Capture.png"> | ||
<img width="400" src="https://i.postimg.cc/bvYx7yWB/Capture.png"> | ||
</p> | ||
|
||
### About | ||
|
||
The game was made using [Processing](https://processing.org). | ||
|
||
The rules are pretty straight forward : eat the food , don't be the food. | ||
I succeed adding the A* algorithm, I was using Gandalf to help me. | ||
|
||
### What's New? | ||
* Tricky, the one who is always drunk | ||
* Pinky, it's not the smart type | ||
* A nice looking path | ||
* Ghost interaction with Pacman | ||
* Weak Mode for ghosts | ||
* Auto return to home when a ghost is eaten by Pacman | ||
* Few bugs fixed | ||
|
||
### Credits | ||
* [CodeBullet](https://www.youtube.com/channel/UC0e3QhIYukixgh5VVpKHH9Q) | ||
* [GeeksForGeeks](https://www.geeksforgeeks.org) | ||
* [Wikipedia](https://en.wikipedia.org/wiki/Pac-Man) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
class Destroyer extends Ghost { | ||
Destroyer(int x, int y){ | ||
super(x, y); | ||
super.currentCell = array.get(y / sc).get(x / sc); | ||
} | ||
|
||
public void search() { | ||
// best search | ||
if(super.x % sc == 0 && super.y % sc == 0){ | ||
super.i = (int)super.y / sc; | ||
super.j = (int)super.x / sc; | ||
AStar(array.get(super.i).get(super.j), array.get(pacman.j).get(pacman.i)); | ||
super.searchingList = path; | ||
} | ||
|
||
super.update(); | ||
super.currentCell = array.get(super.i).get(super.j); | ||
// when is weak and can be af | ||
if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ | ||
// pincky style | ||
super.searchingList.remove( super.currentCell ); | ||
|
||
AStar(super.currentCell, super.cellToFollow); | ||
super.searchingList = path; | ||
|
||
if(super.searchingList.size() <= 2 ){ | ||
if(super.isWeak) | ||
super.cellToFollow = super.getRandomCell(); | ||
else if(super.isRecovering) | ||
super.cellToFollow = super.getRandomCellFromHome(); | ||
} | ||
|
||
} else { | ||
AStar( super.currentCell, pacman.currentCell ); | ||
super.searchingList = path; | ||
} | ||
} | ||
super.update(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.