Discuss Scratch

Dancreatesgames
Scratcher
36 posts

Dying when clicking the flag (Fixed)

When I die in my game and I click the flag I die again so I have to click the flag twice
And here is the script if you need it
when I receive [ death]
stop [ other scripts in sprite]
switch costume to [ death]
repeat (10)
change [ gravity] by (1)
end
wait (0.1) secs
repeat (10)
change [ gravity] by (-1)
end
set [ gravity ] to [0]
repeat (2)
next costume
wait (0.3) secs
end
stop [ all]

Last edited by Dancreatesgames (April 1, 2024 15:41:36)

RokCoder
Scratcher
1000+ posts

Dying when clicking the flag (Fixed)

It would be easier if you shared your project rather than sharing a tiny bit script.

My guess is that you've got green flag blocks all over the place. One of these probably has set health to 100 (or similar) in it. Another probably has if health = 0 then broadcast death (or similar) in it. You have no control over which order those green flag blocks are being called in.

You're probably dying when your health reaches zero and it just isn't being reset before you're checking it again zero after clicking the green flag.

Last edited by RokCoder (April 1, 2024 15:33:41)



Scratch dabbling for fun…

Dancreatesgames
Scratcher
36 posts

Dying when clicking the flag (Fixed)

RokCoder wrote:

It would be easier if you shared your project rather than sharing a tiny bit script.

My guess is that you've got green flag blocks all over the place. One of these probably has set health to 100 (or similar) in it. Another probably has if health = 0 then broadcast death (or similar) in it. You have no control over which order those green flag blocks are being called in.

You're probably dying when your health reaches zero and it just isn't being reset before you're checking it again zero after clicking the green flag.
I just did
wait (0) secs
if <touching [ enemy] ?> then
broadcast [ death]
end
and it worked

Powered by DjangoBB