Advertisement
chris33556

oildrum_anim_test

Aug 6th, 2022
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. extends KinematicBody
  2.  
  3. var gravity = 9.8
  4. var jump = 5
  5. var velocity = Vector3()
  6. export (int) var health := 30
  7.  
  8. onready var animatedSprite = $AnimatedSprite3D
  9.  
  10. func _process(delta):
  11.  
  12.  
  13. if not is_on_floor():
  14. velocity.y -= gravity * delta
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. move_and_slide(velocity, Vector3.UP)
  22.  
  23. func handle_hit(damage: int):
  24. health -= damage
  25. print("enemy was hit!, current health: " + str(health))
  26. if health <= 20:
  27. $oildrumDamage.play("oildrum_damage_1")
  28. if health <= 10:
  29. $oildrumDamage.play("oildrum_damage_2")
  30. if health <= 0:
  31. queue_free()
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement