How do you code health and damage?

please help

Put some text in the frames of gameplay indicating the health and give it a name like ‘playerHealth’.
Put a frame in a different layer(Place it where the gameplay is if the gameplay isn’t at the starting.) Stretch the frame to the last frame of the gameplay.
Put this code in the frame’s default.

put this code in the character in every instance of it in the gameplay.

replace that with the enemy’s name
replace damage with the number of damage you want the enemy to deal.
replace playerHealth with the name you chose for the health text.
If you added something before the number of health do this instead of just project.score

replace HP: with what you put before 100 in your health text.
That should work.

1 Like

@Cleetus_Kernel’s method is successful, but there is another way where you could have an actual bar that shows the player’s health. It’s not as confusing as it is to explain it, so I’ll just give u an example:
how to do health.wick file (9.2 KB)
(arrows to move, and also sorry for the darkness in the frame, I was testing with opacity)

I went to verify my solution and it worked. Made a pretty cool minigame in the process.
Download the HTML file here .

1 Like

btw in order for the game not to be rigged, I had to decrease the damage to 0.5 and the enemy’s speed had to be 2.

sorry I didn’t end up using health in my game but this was very informative:D
you can check out my game here : bad guys _) (2) - Copy.html (2.3 MB)