Drag and Drop

We're going to make sprites draggable, and make a simple matching game. Making sprites draggable is also useful in many other projects.
Play this demo in full screen.
1) Make two copies of a sprite. Make sure to give them different names. Move the target sprite to a corner.
Play this demo in full screen.
2) To make the other sprite draggable, we're going to start off by making it follow the mouse all the time (similar to Squid Chase).
Play this demo in full screen.
3) Make the moving sprite only start following your mouse when you click on it.
Play this demo in full screen.
4) Make the moving sprite stop following your mouse when you are no longer holding down your mouse button.
Hint: There are multiple ways of accomplishing this. You can try using a new looping construct, or have a variable that keeps track of if you are dragging the sprite.
Play this demo in full screen.
5) Repeat steps 1-4 for each pair of sprites you'd like in your matching game.
Play this demo in full screen.
6) When all of your pairs match, tell the player they won the game!
Play this demo in full screen.
7) (Bonus) Make offsets to prevent the sprites from snapping to the mouse when you click them.
Play this demo in full screen.