Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help with script :(
- ThieuwDN
-
New Scratcher
2 posts
Need help with script :(
Hi Community,
The first thing that I want to say is that I am new to this community and the Developing world, so I still have to find my way
.
I have created an “Avoid the Traffic” game but I got stuck with the scripting and don't know what to do.
The problem is that when I want to restart the game (after the ‘Game Over!’ screen, so when I press the ‘restart’ button) the backdrop loads but the cars don't appear. I have checked all my scripts but I still can't find the problem.
Can someone please look into it and give me some tips? Criticism is also allowed, it will help me improve and challenge me to get better.
Link to my game: https://scratch.mit.edu/projects/143659847/
Warm Regards,
ThieuwDN
The first thing that I want to say is that I am new to this community and the Developing world, so I still have to find my way
.I have created an “Avoid the Traffic” game but I got stuck with the scripting and don't know what to do.

The problem is that when I want to restart the game (after the ‘Game Over!’ screen, so when I press the ‘restart’ button) the backdrop loads but the cars don't appear. I have checked all my scripts but I still can't find the problem.
Can someone please look into it and give me some tips? Criticism is also allowed, it will help me improve and challenge me to get better.

Link to my game: https://scratch.mit.edu/projects/143659847/
Warm Regards,
ThieuwDN
- KamikazeKumquats
-
Scratcher
64 posts
Need help with script :(
You could make it when the restart button is clicked it broadcasts a message and when the cars receive that message, they show and move again.
Last edited by KamikazeKumquats (Feb. 6, 2017 16:35:50)
- fuzzygamer512
-
Scratcher
100+ posts
Need help with script :(
I think it has to do with this script:
when green flag clickedand
forever
hide
end
when backdrop switches to [ Game Over!v]
forever
hide
end
Last edited by fuzzygamer512 (Feb. 6, 2017 16:51:32)
- BASIC4U
-
Scratcher
54 posts
Need help with script :(
I removed all the forever loops and replaced a couple of them with repeat until loops, added some extra logic around moving the player's car to prevent pressing down arrow a bunch to get lots of points, and added some math to the bug-car to have it spawn in either of the two lanes randomly. It is better to not have that many forever loops, especially when hiding a sprite forever isn't really any better than hiding it once. Overall, it mostly worked, but I try to avoid using forever loops without a wait block for performance reasons. That's probably just because I usually Scratch on a Dell Dimension 2400 though 
Link to remix: https://scratch.mit.edu/projects/143829894/

Link to remix: https://scratch.mit.edu/projects/143829894/
- ThieuwDN
-
New Scratcher
2 posts
Need help with script :(
Hi guys,
Thanks to you guys the game works perfectly without any problems.
I thank you all for your time and effort in helping me out!
Warm Regards,
ThieuwDN
Thanks to you guys the game works perfectly without any problems.
I thank you all for your time and effort in helping me out!
Warm Regards,
ThieuwDN
- Discussion Forums
- » Help with Scripts
-
» Need help with script :(