Made some changes :)

This commit is contained in:
pennyrigate 2022-12-08 23:28:49 -05:00
parent 038935709f
commit 8f6a068eba
76 changed files with 889 additions and 36 deletions

View file

@ -2,6 +2,7 @@ extends Node2D
export var can_be_killed_by_sword = true
export var can_be_squashed = true
export var score_for_killing = 0
func _on_Area2D_area_entered(area):
#Kill player
@ -10,9 +11,15 @@ func _on_Area2D_area_entered(area):
#Die from sword
if area.is_in_group("sword"):
if can_be_killed_by_sword:
queue_free()
die()
else:
Game.instance_node(Game.block_text,global_position.x,global_position.y,get_parent())
#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()
die()
func die():
Game.score += score_for_killing
queue_free()