Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. export (int) var speed = 200
  2.  
  3. var velocity = Vector2()
  4.  
  5. func _physics_process(delta):
  6. velocity = (get_global_mouse_position() - position).normalized() * speed
  7. # rotation = velocity.angle()
  8. if (get_global_mouse_position() - position).length() > 5:
  9. move_and_slide(velocity)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement