enemies can be squashed by rocks
This commit is contained in:
parent
20fa885736
commit
4790b2b2a4
9 changed files with 34 additions and 26 deletions
|
@ -1,6 +1,7 @@
|
|||
extends Node2D
|
||||
|
||||
export var can_be_killed_by_sword = true
|
||||
export var can_be_squashed = true
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
#Kill player
|
||||
|
@ -10,4 +11,8 @@ func _on_Area2D_area_entered(area):
|
|||
if area.is_in_group("sword"):
|
||||
if can_be_killed_by_sword:
|
||||
queue_free()
|
||||
|
||||
#Die from rock/ get squashed
|
||||
if area.is_in_group("squash"):
|
||||
var squasher = area.get_parent()
|
||||
if squasher.position.y + squasher.bottom.position.y < global_position.y:
|
||||
queue_free()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue