ZainWD

Untitled

Apr 15th, 2021
824
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # A base for every character, enemy, etc. in the game.
  2. extends Position2D
  3.  
  4. class_name Battler
  5.  
  6. export var target_offset_distance: float = 120.0
  7.  
  8. export var stats: Resource
  9. export var skills: Resource
  10. onready var sprite = $Sprite
  11. onready var ai = $AI
  12. onready var hp_bar = $HP
  13.  
  14. var selected: bool = false setget set_selected
  15.  
  16. export var playable: bool
  17.  
  18. func initialize():
  19.     appear()
  20.     stats.initialize()
  21.     hp_bar.text = str(stats.hp)
  22.  
  23. # Handles the individual battler appearing in battle
  24. func appear():
  25.     print("battler appear")
  26.     var offset_direction = 1.5
  27.     sprite.position.y += target_offset_distance * offset_direction
  28.     sprite.appear()
  29.  
  30. func can_move() -> bool:
  31.     return stats.hp > 0
  32.  
  33. func set_selected(value):
  34.     selected = value
  35.     #sprite.blink = true
  36.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×