We'll declare a couple of global variables to store the mouse x and y position.
Just while we're working on this, we'll also display those variables on each frame.
I've temporarily removed our Sprite definition just to keep things smaller until we need it.
Have a look at the code below and make sure you understand it. It's a lot simpler than just of the code we've seen recently.
(It just keeps displaying "0,0" because we haven't added the bit to detect the mouse position yet)
|