We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone, we are a group of students who are working on a processing projet about Pacman Game. We wanted to create, as similar as possible, the original game. Perhaps, it is getting more difficult than what we thought at the begining :(
Our first question is about the mouvement of ghosts.
How can we manage to make the ghost follow the pacman. We were thinking about creating two vectros, one which relies the position of the pacman and the ghost, and the oder which is a constant horizontal (1,0)
Then, calculate the angle between the two vectors.
If the angle is 0< A <PI/2 the ghost can go to the right and up.
If the angle is PI /2< A < PI the ghost can go the left and up.
If the angle is PI < A < 3PI/2 the ghost can go down and left.
If the angle is 3 PI/2 < A <0 the ghost can go right and down.
Is there any posibility to do it?
Thank you so so much in advance.
Answers
why not just compare the x and y coordinates of the two objects? i don't see why you need an angle.
also, did you know that in the original the 4 ghosts had 4 different rules for tracking? - chapter 4 here: http://www.gamasutra.com/view/feature/3938/the_pacman_dossier.php
I've already done Pacman.
https://forum.processing.org/two/discussion/11156/pac-man-game-not-completed-asking-for-assistance
If you have questions about it, post your code.