Discuss Scratch

dan0314
New Scratcher
1 post

i need help on my pacman game making more than one script work

my scripts for the point system are not working
mwiedmann
Scratcher
100+ posts

i need help on my pacman game making more than one script work


You need FOREVER blocks around all of those “If touching sprite” blocks or Scratch will only evaluate it one time. The forever block will make sure it keeps checking it.

I would take all of those checks and group them all together under 1 “When GF Clicked”. Then you only have 1 forever block and you can just check each sprite in a row. You can even make it more efficient by using IF..THEN.ELSE because you shouldn't be able to touch multiple dots at the same time right?
xb500002
Scratcher
4 posts

i need help on my pacman game making more than one script work

mwiedmann wrote:

You need FOREVER blocks around all of those “If touching sprite” blocks or Scratch will only evaluate it one time. The forever block will make sure it keeps checking it.

I would take all of those checks and group them all together under 1 “When GF Clicked”. Then you only have 1 forever block and you can just check each sprite in a row. You can even make it more efficient by using IF..THEN.ELSE because you shouldn't be able to touch multiple dots at the same time right?

Like: THIS IS A GHOST SCRIPT
when gf clicked
forever
if <touching ?> then
play sound until done

and: THESE ARE DOT SCRIPTS
when gf clicked
repeat (244)//There are 244 Pac-Dots in Pac-Man.
create clone of
end

when I start as a clone
repeat (244)
change by (1)
if <(dots to find) = (1) then
go to x: (wanted x position) y: (wanted y position)
end
if <(dots to find) = (2)> then
go to x: (wanted x position) y: (wanted y position)
end
and so on…

Like that?

Powered by DjangoBB