Discuss Scratch

griffinclaw303
Scratcher
10 posts

Flash player

I am coding a game, but, one script always crashes the flash player on any computer that I'm using! How can I test my game if this happens?
super_crazy
Scratcher
100+ posts

Flash player

Could you please share and add a link to the project in which the problem occurs so we can try fix the problem.

Is the script which crashes a “define” block? If so then perhaps the problem is that it is set to “run without refresh” and is stuck in a loop. This causes it to forever loop through the code without refreshing the screen and therefore crashing flash player.

griffinclaw303
Scratcher
10 posts

Flash player

Your text to link here…

It does use a ‘define’ block, but that works. The script that crashes doesn't use one.
super_crazy
Scratcher
100+ posts

Flash player

The problem lies in ‘sprite 1’. You are always creating a clone in the forever loop then the clone is also creating a clone before it deletes itself. This means the project is very quickly creating and deleting many clones causing the project to crash.

You do not need to forever create a clone but rather only once every few seconds then delete the clone once it reaches the top.
For Example:

whenclickedgotox:0y:-180 Start at the bottom of the screengotofronthide We only want the clones to showwhenIreceivemessage1forevercreatecloneofmyself Create a clone of the spritewait3secs Wait a bit before creating another clonewhenIstartasacloneshow Show the clone so we can see itfall Call the fall custom block we createddefinefallrepeatuntilyposition>180changeyby5 Move the clone up repeat the following code until the clone is at the topdeletethisclone Delete the clone once it has reached the top

This will stop it from crashing the project. I think this is what you were trying to achieve however if it isn't feel free to ask.
If you want the clones to spawn randomly along the bottom you can add this to the top of the “when I start as a clone” block:

setxtopickrandom-200to200

Anyway, I hope that solved your problem

Super_crazy
griffinclaw303
Scratcher
10 posts

Flash player

Thank you! I will try this and see if it works.

Powered by DjangoBB