![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Coenster |
First, I am still working in Godot 2.1.4
I have two Kinematic Bodies one is a “monster” the other is the “Player” when they collide some calculations happen and who ever has the least amount of health “dies” and the player will get 1 point for defeating the “monster”.
But the calculations happens for the duration of the collision and the “monster” only dies when they are not colliding anymore. So the player ends up with a huge amount of points for as long as he is colliding with the monster.
How can I check for the first collision response, do the calculations, slay the monster or get slain and not wait for them to stop colliding first.
Here is my code for check if they are colliding:
if is_colliding():
if (get_collider().has_method("is_player")):
if (get_collider().player_size >= monster_size):
get_node("AnimationPlayer").play("monster_die")
get_owner().get_node("Player").points_collected += monster_value
print("monster killed")
else:
print("player killed")
else:
print("This is not the player")
Any help will be appreciated, I am still new at this so please be gentle if code or format is not up to standard