Follow the mouse
Read the mouse coordinates every frame and move the sprite to that position.
whenGreenFlag(() => { forever(() => { goto(getMouseX(), getMouseY()); });});The sprite snaps to the cursor instantly on every tick. To make it lag behind the
cursor for a smoother feel, use glide with a very short duration instead.
whenGreenFlag(() => { forever(() => { glide(0.05, getMouseX(), getMouseY()); });});Functions used
Section titled βFunctions usedβwhenGreenFlagβ run code when the green flag is clickedforeverβ repeat a block of code indefinitelygotoβ move to a position instantlyglideβ animate to a position over timegetMouseXβ get the mouse x positiongetMouseYβ get the mouse y position