Enemy health?
-
I have multiple enemy images and I have multiple health variables for each! How would I assign the correct variable to the correct enemy?
-
You can assign user defined properties to sprites: https://fuzearena.com/forum/topic/521/sprite-properties?_=1634995896862
So create a sprite from your images and then add properties
monsterImage = loadimage("Untied Games/Creeper") monster1 = createsprite() setspriteimage(monster1, monsterimage) monster1.health = 100
-
If an enemy has low hit points and to save on variables I'v started using rgba values, so on each hit it would minus enemy1.r -= .1 then if enemy.r <= .5 it gets removed. You could do it in many ways you could increase there speed and access it that way to get some extra challenge to the fight.
-
Thanks so much I'll give it a shot
-
I like to use a data table to store the Information.
Enemydata = [
[.img = loadimage("image1"), .health = 5],
[.img = loadimage("image2"), .health = 10]
] -
@ben-2-0 how would I access a data table?
-
Enemyid = random(len(enemydata))
Enemy.img = enemydata[enemyid].img
Enemy.health = enemydata[enemyid].healthSomething like this. This picks a random enemy from the table and gives it the values inside the inner tables. This is kinda complex so if you are just starting out you may not want to use this method.
-
I got it working thanks everyone