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
- func _process(delta):
- if not is_on_floor():
- velocity.y -= gravity * delta
- move_and_slide(velocity, Vector3.UP)
- 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:
- queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement