Controllers and Graphics
How do we get objects to move using the keyboard, mouse, or a game controller?
So far, we’ve shown how to animate items on the screen, but not how to interact with them. How do we use a mouse, keyboard, or game controller to control the action onscreen? Thankfully this is pretty easy.
To begin with, it is necessary to have an object that can be moved around the screen. The best way to do this is to have a function that takes in an x and y coordinate, then draws an object at that location. So back to Chapter ...