Discuss Scratch

dpowis
Scratcher
1 post

Help with the random block

Hello, so I was wondering if any of you had come across the problem of a certain block not working after a certain amount of times of it being played (for example it would work on the 1st to 3rd try but fail on the 4th)
I have the Random block clipped to a "When green flag, If (something touches) then go to [Random to " It touches the block that I have clipped in the script shown everytime one of the games end

By the way I am making a Pong remake and it is proven harder than ever.

Appreciate any help

Daniel
drmcw
Scratcher
1000+ posts

Help with the random block

Sounds like you need a loop block in there like a forever block. You need to keep running the if touching script and the only way to do that is to keep looping round. A when green flag clicked block runs when the green flag is clicked but ends as soon as it reaches the end of the script, so to keep it running, add a loop of some kind.

Last edited by drmcw (July 5, 2013 21:06:09)

polstrak
Teacher
2 posts

Help with the random block

I am not sure I totally understand the problem, but the advise above sounds good. Usually when one of my programs does that it is because some other event has happened that makes the original code not execute any more.

Powered by DjangoBB