Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | HeroRobb | |
Old Version | Published before Godot 3 was released. |
I’m having an issue with collisions. Basically, I test to see if an enemy hit the player, and then do stuff accordingly. Like this
if (is_colliding() && get_collider() extends playerPreload):
The problem is that now that I’ve started implementing an attack the player can do, it’s crashing. I’ve made the attack have a separate hitbox that only monitors while the player is attacking. This works fine about 90% of the time, but if an enemy moves into the attacking hitbox after the player has begun to attack, the code above crashes with the error “Left operand of ‘extends’ is not an instance of anything.”
So, is there a way around this? I suppose I could turn the attack hitboxes into their own scene, but that doesn’t seem like the most efficient approach.
I guess you should just write get_collider() != null
, but I’m not really sure…
Bojidar Marinov | 2016-03-17 09:52