Middle school student, age 13, teaches you how to get mouse control working on the moving square.
- Goes through event queue to check for the mouse button. event.type == MOUSEBUTTONDOWN:
- Checks for point collision with a rectangle: collidepoint(mouse_pos)
In terms of the response of a touch screen device, how does the device distinguish between a touch and a swipe? So far it looks to me like simply touching the screen to start a swipe is interpreted as a buttondown event. This behavior doesn't seem compatible with a game where you want to direct, say, the path of a projectile with swiping and the launch of the projectile with a touch of a soft button put on the screen by the app while the user is still swiping.
ReplyDeletePygame can't do a swipe. Create a virtual controller. https://www.youtube.com/watch?v=2J7heJQ83lM
ReplyDeleteIf you really need a swipe, and you game may not, you'll need to use Kivy. However, that's more complex, both for adults, and kids. Suggest you keep to Pygame. http://kivy.org/#home
Delete