Advertisement
otorp2

angle to point with timer

Nov 11th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1.  
  2. extends Node2D
  3.  
  4. # member variables here, example:
  5. # var a=2
  6. # var b="textvar"
  7. var vector_a = Vector2(0,0)
  8. var vector_b = Vector2(-50,-50)
  9. var count = 0
  10.  
  11.  
  12. func _ready():
  13.  
  14. #print(rad2deg(vector_a.angle_to_point(vector_b)))
  15. #print(str(Vector2(0.0,0.0).angle_to_point(Vector2(50, 50))))
  16. #print(vector_a.distance_squared_to(vector_b))
  17. pass
  18.  
  19.  
  20. func _draw():
  21.  
  22. draw_line(vector_a,vector_b,Color(255,0,0))
  23. print("hello")
  24. print(vector_a.angle_to_point(vector_b))
  25.  
  26.  
  27. func _on_Timer_timeout():
  28. count +=1
  29. print(count)
  30. vector_b += Vector2(1,0)
  31. if vector_b.x > 50:
  32. vector_b.x = - 50
  33. update()
  34. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement