Discuss Scratch

rionaogr3086
Scratcher
4 posts

My Sprite isn't working!

So, My sprite has a code thingy like this that appears when the character goes to 0 hp in a fight scene:
when I receive [ End]
say [Don't give up!] for (2) secs
say [I believe in you!] for (2) secs
broadcast [ Battle]

But it always freezes on the first speech, so could some please help me find the problem?
Here's the link: https://scratch.mit.edu/projects/159278290/#player

Last edited by rionaogr3086 (May 20, 2017 12:43:32)

asivi
Scratcher
1000+ posts

My Sprite isn't working!

Hi, probably you are broadcasting “end” more times than one, forcing to restart yhe script you posted

when green flag clicked
set [health v] to [40]
forever
if <(health) < [1]> then
hide
broadcast [End v]//here
switch backdrop to [backdrop1 v]
hide variable [health v]
end
end

Perhaps if you remove it and do use of the backdrop switch will fix it

when backdrop switches to [backdrop1]
say [Don't give up!] for (2) secs
say [I believe in you!] for (2) secs
broadcast [ Battle]
rionaogr3086
Scratcher
4 posts

My Sprite isn't working!

@asivi Thanks! I redid some of the script and added in your idea and it finally worked.

Powered by DjangoBB