Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do me make health for different enemies
- Fox_Roller
- Scratcher
1 post
How do me make health for different enemies
me need help with tower defance gan it hard to assign enemies different hp using variable me need halp me sad
- Jareddddddd
- Scratcher
1000+ posts
How do me make health for different enemies
if you create a variable, and tick the “for this sprite” box, when you create a clone, each clone gets their own copy of that variable. So, if you have the enemies pathing already done you can use that variable to track the health
example clone data:
https://scratch.mit.edu/projects/741043035/
example clone data:
https://scratch.mit.edu/projects/741043035/
- Avirs
- Scratcher
2 posts
How do me make health for different enemies
I know you already got a reply, but uh. I'll reply anyways. I may not be experienced with the topic of cloning ID's and such. But I'll try explaining anyways,
What you need to go is go into the variables section. Once you are there, create a variable named HP or something to remind you in which this is the variable for health of your enemies. Also make sure you have ticked the box for it only being for the enemy sprite. Make the costumes for your enemies, or make them have the same costume. I won't judge. After that, you want to set the health. So set it to whatever you want to set it to. Then spawn in the clone, that variable will be the same for that clone. and you will have to repeat this in some sort of way for each enemy, This one enemy you might want to have five hundred HP, so set the variable of health to five hundred then have the enemy sprite cloned. Maybe another enemy with one hundred HP, just set the variable of health to one hundred, and so on.
(I might be wrong, I might not. But hopefully it works.)
What you need to go is go into the variables section. Once you are there, create a variable named HP or something to remind you in which this is the variable for health of your enemies. Also make sure you have ticked the box for it only being for the enemy sprite. Make the costumes for your enemies, or make them have the same costume. I won't judge. After that, you want to set the health. So set it to whatever you want to set it to. Then spawn in the clone, that variable will be the same for that clone. and you will have to repeat this in some sort of way for each enemy, This one enemy you might want to have five hundred HP, so set the variable of health to five hundred then have the enemy sprite cloned. Maybe another enemy with one hundred HP, just set the variable of health to one hundred, and so on.
(I might be wrong, I might not. But hopefully it works.)
- Discussion Forums
- » Help with Scripts
- » How do me make health for different enemies