game: add xp orbs
This commit is contained in:
@@ -15,6 +15,7 @@ var max_health: float
|
||||
var god_mode: bool = false
|
||||
var is_dead: bool = false
|
||||
|
||||
var _xp_orb = preload("res://scenes/xp_orb.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
move_speed = default_move_speed
|
||||
@@ -57,11 +58,17 @@ func die():
|
||||
if is_dead:
|
||||
return
|
||||
is_dead = true
|
||||
drop_xp_orb()
|
||||
target = null
|
||||
velocity = Vector2.ZERO
|
||||
animation_player.play("die")
|
||||
animation_player.animation_finished.connect(_on_die_anim_finished)
|
||||
|
||||
func drop_xp_orb() -> void:
|
||||
var orb: XPOrb = _xp_orb.instantiate()
|
||||
orb.value = 5
|
||||
orb.position = position
|
||||
get_parent().add_child(orb)
|
||||
|
||||
func cheer_anim():
|
||||
if not animation_player.is_playing():
|
||||
|
Reference in New Issue
Block a user