bodypartfighter/BodyParts/PushingBodyPart.gd
2020-02-02 12:14:27 +01:00

29 lines
622 B
GDScript

extends BodyPart
class_name PushingBodyPart
onready var touch_area = get_node("TouchArea")
export(float) var damage = 10.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
touch_area.connect("body_entered", self, "_on_touch_area_entered")
# Override in derived classes!
func _is_animation_playing():
return true
func _on_touch_area_entered(body):
if body.name != base.name and _is_animation_playing():
if body.is_in_group("Terrain"):
push(body)
elif body.is_in_group("Player"):
InGameState.subtract_player_health(body.player_id, damage)
func push(body):
pass