godot : sprite move to mouse positionsteemCreated with Sketch.

in godot •  7 years ago  (edited)
const MOTION_SPEED = 350 # Pixels/second<br>
func ... <br>
    var m  = get_global_mouse_pos()
    var motion = Vector2(m.x-get_pos().x,m.y-get_pos().y)
    motion = motion.normalized()*MOTION_SPEED*delta
    move(motion)
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!