Controlling sprites with the mouse
This tutorial will show you how to control sprites with the mouse in Pygame. Download and open the file below.
mousecontrol.py | |
File Size: | 3 kb |
File Type: | py |
Tasks
1. Change the code so the background colour also changes when the mouse is clicked
2. Change the code so the size of the square changes when it is being dragged, but returns to normal when released
3. Change the code so the sprite constantly follows the mouse pointer, even when the mouse is not clicked
4. Change the code so the sprite disappears when clicked on and reappears at the top of the screen
2. Change the code so the size of the square changes when it is being dragged, but returns to normal when released
3. Change the code so the sprite constantly follows the mouse pointer, even when the mouse is not clicked
4. Change the code so the sprite disappears when clicked on and reappears at the top of the screen