Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » need help with pacman
- scratcher_1379
- New to Scratch
7 posts
need help with pacman
hello
what should I write for the enemies of my main sprite I mean the four little things.that when they hit walls change their direction?and please explain your answer.
what should I write for the enemies of my main sprite I mean the four little things.that when they hit walls change their direction?and please explain your answer.
- elcidero
- Scratcher
39 posts
need help with pacman
Could you elaborate a little more? It's not clear exactly what you need help with. Also, perhaps you could provide a link to your project?
- scratcher_1379
- New to Scratch
7 posts
need help with pacman
I mean the scripts for the ghosts.for the movements of them that they move correctly when they touch the walls change their direction correctly
pacman
and that is my project right now i should add a lot of thigs to it.
pacman
and that is my project right now i should add a lot of thigs to it.
- elcidero
- Scratcher
39 posts
need help with pacman
You could put four tiny dots of different colors on the ghosts. You could put one on the head, on at the bottom, and one on each side. This would function like this:
Say you put a red dot on the ghost's head.
With this script, say the ghost was heading up. It hits a wall with its head (because the head is always at the top), and the white wall touches the red dot. This would trigger the if block, so the sprite would move down and away from the wall ten steps.If you did this, you'd have to make it so their head pointed up all the time.
This isn't a complete fix, but it's a start.
Say you put a red dot on the ghost's head.
when green flag clicked
forever
if <color [White] is touching [Red]?> then
change y by (-10)
end
end
With this script, say the ghost was heading up. It hits a wall with its head (because the head is always at the top), and the white wall touches the red dot. This would trigger the if block, so the sprite would move down and away from the wall ten steps.If you did this, you'd have to make it so their head pointed up all the time.
This isn't a complete fix, but it's a start.
- scratcher_1379
- New to Scratch
7 posts
need help with pacman
could you please help a little more,what should i write for their movement that they move correctly.(if you have seen my project you know what do i mean.
- scratcher_1379
- New to Scratch
7 posts
need help with pacman
If anyone knows please help. i really need it,really
- Discussion Forums
- » Help with Scripts
- » need help with pacman