My issue

I have been racking my head around how to achieve invincibility frames. Working in the Godot Engine I have considered a few methods for this:

  • Setting a Timer Node when damaged to trigger the invincibility
  • setting a knockback variable, converting it into an int which is then multiplied by the movement vector.

move_dir * int(self.knockback)

Each of these runs into the problem of how do I return the state back at a set interval to prevent some sort of ping-pong effect when many enemies are present.

there likely is something better that I haven't yet considered for this, but I just want to know what else is out there for this. Any algorithms or techniques will be welcome. I just want to help get the end of this.

  • \$\begingroup\$ Can you define in more detail what would make an interval "proper" for your game's needs? \$\endgroup\$ – DMGregory Jul 8 '20 at 11:11

For the invincibility frame I’m not quite sure what you mean, but I would recommend watching this video: https://youtu.be/Cx_i4Uei_ME As it helped me with something sort of similar

As for the knockback variable do you mean the player takes knock back from enemy damage? Or do you meant the player gives knock back to an enemy? Also is it 2d or 3D because the answer will definitely vary based on that alone.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.