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.