[Solved]Activation shield in the Health extension

Hello! Can anyone explain how to properly activate the shield in the Health extension? In the example on the site, after activation, the shield blocks 100 damage and disappears, and further damage goes to the ship. I tried to repeat the code, but after activation, the shield blocks damage indefinitely, and if the value of the shield is set less than the incoming damage, then it blocks part of it, like armor. Without activation, the shield does not work

at all.

Could you give a link to the example you are referring to?

Sorry, I thought everyone saw this example. Open Your GDevelop > Home > Build > Recommended templates > Show all > Search example > health with shield

No need to be sorry. I did not know about the example. It is pretty cool.

At the moment my guess is that indeed the activation of the shield-event is the problem. You have it in an event block without condition which means it is just constantly activated. In the example project it is activated after the collision with a power-up. So you also need to find a condition that activates the shield (e.g. a button press or if the enemy is approaching your player etc.).

Edit from Drona: Actually I wanted to reply to this post and not edit it.

I read your post and saw the screenshots but then I somehow made a mistake by editing your post instead of replying to it.

Anyway, your shield is created before the activation because the draw-event has no conditions and will be triggered anytime. Your activation-event has a condition (the key release) and is only triggered when this condition is met. You could put your draw-events together with the activation event for getting both at the same time.

Thanks, I moved the creation of the shield to a sub-event and now everything works correctly - both activation and when regeneration is turned on. Can re-add screenshots - suddenly someone will come in handy?

1 Like

Great to hear that it works now. I don’t know how to reverse the editing. Maybe you could post your events again for reference?