Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody
- var gravity = 9.8
- var jump = 5
- var velocity = Vector3()
- export (int) var health := 30
- onready var animatedSprite = $AnimatedSprite3D
- onready var particles: Particles = $Particles
- func handle_hit(damage: int):
- health -= damage
- print("enemy was hit!, current health: " + str(health))
- if health <= 20:
- $oildrumDamage.play("oildrum_damage_1")
- if health <= 10:
- $oildrumDamage.play("oildrum_damage_2")
- if health <= 0:
- destroy()
- func destroy() -> void:
- $oildrumDamage.visible = false
- particles.emitting = true
- yield(get_tree().create_timer(particles.lifetime, false), "timeout")
- queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement