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_top: Particles = $Particles
- onready var particles_bottom: Particles = $Particles2 # The second particle emitter for the bottom of the drum
- 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_top.emitting = true
- particles_bottom.emitting = true # Need to set emiting to true for both of the particles
- yield(get_tree().create_timer(particles_top.lifetime, false), "timeout")
- queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement