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
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.).
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?