Advertisement
otorp2

node/path/pathfollow/sprite

Nov 14th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. func _ready():
  2. set_process(true)
  3.  
  4. func _process(delta):
  5. #print(get_node("Path2D").get_curve().get_point_count())
  6. if get_node("Path2D").get_curve().get_point_count() < 2:
  7. set_process(false)
  8. return
  9. var n_offset = get_node("Path2D/PathFollow2D").get_offset() + delta * speed
  10. get_node("Path2D/PathFollow2D").set_offset(n_offset)
  11. get_node("Sprite").set_pos( get_node("Path2D/PathFollow2D").get_pos() )
  12. if get_node("Path2D/PathFollow2D").get_unit_offset() >= 1:
  13. set_process(false)
  14. print("hj")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement