Module pygsear.Event
Keyboard and mouse event handling.
This module is used to create objects that relate raw pygame events
(keys being pressed on the keyboard, mouse buttons being clicked, the
pygame window being closed, joystick movement (incomplete)) with other
object methods and functions.
For instance, in your game you may want to use a control where every
time the up arrow is pressed on the keyboard, your player's ship starts
to accelerate. That might look something like:
class Ship:
def initialize(self):
self.events.add(Event.KEYDOWN_Event(key=K_UP, callback=self.accel))
Actually controlling the ship is a bit more complicated than this,
since you probably want the player to be able to hold down the arrow to
keep on accelerating. See some of the examples for more ideas on how to
do that.
MODIFIERS
-
- Type:
-
list
- Value:
[304, 303, 306, 305, 308, 307]
|
|
MOUSEBUTTON
-
- Type:
-
int
- Value:
|