SDTween.gd 410 B

123456789101112131415161718192021222324252627
  1. extends Tween
  2. # Self-destructing Tween which doesn't need a separate cleanup.
  3. # for convenience
  4. var action
  5. var object
  6. var arg
  7. class_name SDTween
  8. func _init(o=null,a=null,ar=null):
  9. action = a
  10. object = o
  11. arg = ar
  12. func _ready():
  13. connect("tween_completed",self,"timeout")
  14. func timeout(arg1, arg2):
  15. queue_free()
  16. if action and object:
  17. if arg:
  18. object.call(action,arg)
  19. else:
  20. object.call(action)