I Don't Know About The Levels But Feel Free To Use The Spirtes From Mine. Just Give Credit!
Offline
Pac Man ghosts are quite difficult to program, I think in the real game the red one checks each intersection it can cross to and pick which one is nearest to pacman, and the others have their own movement personalities.
For the levels, simply set a variable to the number of dots on the ground. When pacman eats a dot, change the variable by -1. When it is equal to 0 (Or less than 1, to avoid miscalculation), broadcast "New Level". When the stage receives that broadcast it should change background (if the next level is a new stage, if not don't put in that), and when each sprite receives it they should go back to where they start, and the variable should be reset.
If you want the levels to get increasingly more difficult, say the ghosts get faster each level, then make a variable called "Speed" (for all sprites). The ghosts should move by (Speed) steps, and when the background receives "New Level" it should change "Speed" by 1.
Last edited by Kileymeister (2011-01-12 11:28:11)
Offline
slitherax wrote:
Thanks for this information! I already had ghosts and had done what you said about the levels, but the problem is that pacman won't move. Is there a reason?
You mean he stops moving when he beats a level? Is the movement script in an if blocks that is false? Are there any repeat blocks in the movement script? Are there any "stop script" blocks in it?
If you could post a picture of your script via www.tinypic.com (without the img tags, as you are a new scratcher), I think I can help.
Last edited by Kileymeister (2011-01-13 15:55:45)
Offline
Ok, perhaps the problem lies with the colors, I see that for the stepping scripts a red sensor needs to be touching a certain color, depending on the level.
If green is the wall, put that piece in a Not (so it reads "forever if not color red is touching green"), or if green is the color of the area you can move on, make sure that a. Your red sensor is the right shade of red, and b. the green floor is the right shade of green.
If you can see little dots of different shades of green on the stage, try smoothing them out with the paint brush and the shade of green you need.
Also, if you move to level two, the first script will still be active, so you'll move twice as fast (it would be like running "move speed steps" twice each loop), so change your moving scripts to this:
Note the added "if" blocks inside the "forever if" blocks.
Also, add the little script at the top so each time you restart the game, the target number goes back to 0.
Last edited by Kileymeister (2011-01-15 08:49:50)
Offline
Hmmm... This script certainly makes a difference as before when it switched to a different level the screen would kind of skip and a low buzzing sound could be heard. Now, everything behaves normally, the screen switches to level 2, but pac-man still won't move. When I press the arrow keys, he turns in that direction without a problem, he just doesn't go forward. Here's a picture of the script now: http://i54.tinypic.com/24who34.gif. I'm really sorry to keep having to ask you for help, but could you try and see what the problem is?
Offline
I'm SO sorry! That script was perfect! I'd just forgotten to press the space button to make him start! Thank you SO much for all your help!
p.s my ghosts seem to stop moving suddenly when the time is around 25 seconds. Do you know of a reason why this is?
http://i55.tinypic.com/34ozjhd.gif (the script is the same for both of them)
Offline