bodypartfighter/BodyParts/PushingBodyPart.gd

24 lines
511 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")
func _on_touch_area_entered(body):
if body.name != base.name:
if body.is_in_group("Terrain"):
push(body)
elif body.is_in_group("Player"):
InGameState.subtract_player_health(body.id, damage)
func push(body):
pass