This is an image with some of the stages coding. I got the images of the web. As Pac-man dies, The code switch to background Pac-man back. This background is slightly different as it has grey instead of black.
This piece of code makes Pac-man move when he touches a black background, as it checks the background, moves, checks the background etc. This corresponds with the previous code to make it so that Pac-man stops moving and has a death animation, as when the background turns slightly grey, Pac-man isn't touching black. This means he stops moving.
I added this to the ghost:
and
The above code checks if the ghost is touching some invisible markers. If it is touching LR1, it chooses 3 or 4. 3 makes it turn left and 4 right. It does this because it checks the variables using the script to the left, and turns in the corresponding direction. It has another piece of code - similar to Pac-man's - that makes it move when touching black. The part above also has a junction, to it randomly chooses to move up, down, left or right, corresponding to variables telling it to.
This piece of code makes Pac-man move when he touches a black background, as it checks the background, moves, checks the background etc. This corresponds with the previous code to make it so that Pac-man stops moving and has a death animation, as when the background turns slightly grey, Pac-man isn't touching black. This means he stops moving.
I added this to the ghost:
and
The above code checks if the ghost is touching some invisible markers. If it is touching LR1, it chooses 3 or 4. 3 makes it turn left and 4 right. It does this because it checks the variables using the script to the left, and turns in the corresponding direction. It has another piece of code - similar to Pac-man's - that makes it move when touching black. The part above also has a junction, to it randomly chooses to move up, down, left or right, corresponding to variables telling it to.
No comments:
Post a Comment