Chest + Door Functionality
This commit is contained in:
@@ -5,6 +5,8 @@ onready var SNOWBALL_SCENE = preload("res://Enemies/Snowball.tscn")
|
||||
var player = null
|
||||
var move = Vector2.ZERO
|
||||
var speed = .5
|
||||
var health: int = 2
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
move = Vector2.ZERO
|
||||
@@ -51,3 +53,14 @@ func _on_player_detector_area_entered(area: Area2D) -> void:
|
||||
func _on_player_detector_area_exited(_area: Area2D):
|
||||
player = null
|
||||
return
|
||||
|
||||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
print("HIT")
|
||||
if area.is_in_group('player_weapon_1'):
|
||||
health -= 1
|
||||
elif area.is_in_group('player_weapon_2'):
|
||||
health -= 2
|
||||
|
||||
if health <= 0:
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
|
Reference in New Issue
Block a user