[Solved] How do i use the health extension

im making a game and i downloaded the health extension in the project manager tab. for the life of me i can not figure out how to implement it. admittedly i am very new to this and this is a trial game for me to learn the ins and outs of gdevelop. i just want to be able to have my player take a certain number of hits and then die. should i use the health extension or is there an easier alternative. keep in mind im a rookie. if it helps im using topdown movement to make a beat em up style game like double dragons

1 Like

Sorry in advance for the mass-picture-upload.
The Health extension is currently the easiest way (unless you know how to use Variables), so:
1a) Firstly, you have to add the Health behaviour to the character(s) objects you want to use it on, like so:


Then set the player’s starting health, and maximum health (this is maximum amount of health the player is allowed, if they eat a food item to heal it will not go above Maximum health).
Make sure to set “Damage cooldown” also, a good value is 0.2 seconds. It’s to make sure the player will not recieve too much damage under one time.

Now we go to Events Sheet of your current scene.
I’ll assume you know how to create an attack for your game.
1b) When the enemy’s attack hits the player, add an event to decrease their health:


1c)Then when the player runs out of health, either delete the player object (in my example) or set the player character’s animation to a “dead” state (which requires a bit more coding, to ensure the player cannot continue attacking/moving).
image
image

That’s the basic way to do it.
This extension is very basic, so if you can do other things like useing variables you can do that instead.

3 Likes

thank you, thats what i tried to do but it did not work, but i think the error was in the the enemy attack

welcome. If you’re still having trouble, you can take screenshot of your current events (if Windows, you can use Snipping Tool and paste in textbox here) and I’ll see what the problem is