Discuss Scratch

WP529
Scratcher
6 posts

How do You make a varaible (health) go to a backround after at 0?

Hi. Im trying to make a game and a script I want to add is going to a certain background after the health go to 0. Could you help me?
ParadoxScratching
Scratcher
100+ posts

How do You make a varaible (health) go to a backround after at 0?

whenclickedforeverifhealth=0thenswitchbackdropto
deck26
Scratcher
1000+ posts

How do You make a varaible (health) go to a backround after at 0?

ParadoxScratching wrote:

whenclickedforeverifhealth=0thenswitchbackdropto
But don't leave a forever loop running and switching backdrop like that 30 times a second. If this can only happen once you really just need a wait until health=0 instead of the loop and if health is only being changed in one place just check for the value hitting 0 there.
ParadoxScratching
Scratcher
100+ posts

How do You make a varaible (health) go to a backround after at 0?

whenclickedforeverifhealth=0thenswitchbackdroptostopthis script
crisostimo
Scratcher
500+ posts

How do You make a varaible (health) go to a backround after at 0?

Deck26 has the advice you want to follow. Basically write something like this for all the places you want to deduct health:

defineDeductHealthByamountchangeCurrent Healthby-1*amountifCurrentHealth<0thensetCurrent Healthto0ifCurrentHealth=0thenswitchbackdroptoNo Health Backdrop
WP529
Scratcher
6 posts

How do You make a varaible (health) go to a backround after at 0?

thanks
Laurenshrek
New Scratcher
1 post

How do You make a varaible (health) go to a backround after at 0?

Hey guys i know how to change the background but i want it to wait for 5 seconds then change back to the original background i really need to know how to do this for a project

Thanks
kiwilover2736
Scratcher
1000+ posts

How do You make a varaible (health) go to a backround after at 0?

Laurenshrek wrote:

Hey guys i know how to change the background but i want it to wait for 5 seconds then change back to the original background i really need to know how to do this for a project

Thanks

Please don't post unrelated questions to the main question of the post! If you want to ask your question please to the main “Help With Scripts” forum page and press the “New Topic” button at the top of the screen!
funnyman123duh
Scratcher
3 posts

How do You make a varaible (health) go to a backround after at 0?

Hi! its easy to do this just follow this line of code=










whenclickedifthenhealth=0switchbackdroptodead

Last edited by funnyman123duh (Oct. 21, 2023 23:04:09)

kiwilover2736
Scratcher
1000+ posts

How do You make a varaible (health) go to a backround after at 0?

funnyman123duh wrote:

Hi! its easy to do this just follow this line of code=










whenclickedifthenhealth=0switchbackdroptodead

Please don't necropost. The creator of this topic got the code that they needed 5 YEARS AGO!

Last edited by kiwilover2736 (Oct. 22, 2023 07:38:15)

cosmosaura
Scratch Team
1000+ posts

How do You make a varaible (health) go to a backround after at 0?

Topic closed to prevent future necroposts.

Powered by DjangoBB