Hello there. I am new to Gdevelop and learning things.
I have two objects. One is the player or character. The other is an enemy or obstacle which is not moving but standing still on the ground plane. It is a platformer game.
Now, when the object jumps on top of the enemy, the enemy gets killed and increases the score of the player. But when the player collides with the enemy from the left direction, meaning on the ground plane, the player gets a life deducted. I am trying to create this type of event. I hope you are getting what I am trying to tell.
“Jumps on top of the enemy, the enemy dies. Gets in touch with the enemy when not jumping or falling, meaning when on the ground, the player loses health.”
Now, for the health system, I have created 3 Duplicate Hearts. Each of them contains two animations, one is active and the other is inactive. Active animation means the player has a life. The inactive animation means the heart goes dark grey when the player loses their health.
I also added a scoring system. This is my third-day using GDevelop BTW. The scoring system is a text, I gave it the name HUD_Points. The initial text to display is “000000” meaning six zeroes. I gave it a variable named “TotalPoints” → Number → 0. Then I added it to the top right screen and shifted to a new layer HUD.
I created another text named “Points” with default text and a variable. The variable name is “MoveToPosition”. It’s a number with a value of 0. The purpose of this text is to show the score gained when the enemy gets killed and it gets added to the previous HUD_Points text.
Also, I have added another “Heart” that will be placed on the ground. Player health will be filled if they touch the heart on the ground.
I was able to create events when the players touch the enemy 3 times in a row without getting the recovery heart, game-over the type of thing. I was able to create that. I was also able to create events when the player jumps on top of the enemy, the enemy gets killed and the player’s score increases.
The problem is, when the player touches the enemy on the ground, it is indeed getting killed after 3 hits but the heart animation is not changing. Meaning, it should reduce the heart counts or change the animation to “inactive” hearts. It is not showing that. That animation is not changing. The player will have to count manually how many times they have got hit. How can I solve this problem?
Below is the screenshot of the events that I have set up.
Please help me solve this error. Thanks in advance.