Class which handles the game.
This class handles most parts of the game which operate on a global scale, such as global game events. Before anything else is done with SGE, an object either of this class or of a class derived from it must be created.
When an object of this class is created, it is automatically assigned to sge.game.
Note: Do not create multiple Game objects. Doing so may cause errors.
Attributes:
Read-Only Attributes:
Create a new Game object and assign it to sge.game.
Arguments set the respective initial attributes of the game. See the documentation for Game for more information.
Start the game at the first room.
Can be called in the middle of a game to start the game over. If you do this, everything will be reset to its original state.
Properly end the game.
Pause the game.
Arguments:
Normal events are not executed while the game is paused. Instead, events with the same name, but prefixed with event_paused_ instead of event_ are executed. Note that not all events have these alternative “paused” events associated with them.
Unpause the game.
Game start event.
Called when the game starts. This is only called once (it is not called again when the game restarts) and it is always the very first event method called.
Game end event.
Called when the game ends. This is only called once and it is always the very last event method called.
Global step event.
Called once each frame.
Arguments:
time_passed is the number of milliseconds that have passed during the last frame.
Key press event.
Called when a key on the keyboard is pressed.
Arguments:
See the documentation for sge.get_key_pressed for more information.
Key release event.
Called when a key on the keyboard is released.
See the documentation for sge.get_key_pressed for more information.
Mouse move event.
Called when the mouse moves.
Arguments:
Mouse button press event.
Called when a mouse button is pressed.
See the documentation for sge.get_mouse_button_pressed for more information.
Mouse button release event.
Called when a mouse button is released.
See the documentation for sge.get_mouse_button_pressed for more information.
Joystick axis move event.
Called when an axis on a joystick changes position.
Arguments:
See the documentation for sge.get_joystick_axis for more information.
Joystick HAT move event.
Called when a HAT switch (also called the POV hat, POV switch, or d-pad) changes position.
Arguments:
See the documentation for sge.get_joystick_hat for more information.
Joystick trackball move event.
Called when a trackball on a joystick moves.
Arguments:
Joystick button press event.
Called when a joystick button is pressed.
See the documentation for sge.get_joystick_button_pressed for more information.
Joystick button release event.
Called when a joystick button is released.
See the documentation for sge.get_joystick_button_pressed for more information.
Close event.
Called when the operating system tells the game to close, e.g. when the user presses the close button in the window frame. It is always called after any sge.Room.event_close occurring at the same time.
Default mouse collision event.
Proxy for sge.game.mouse.event_collision. See the documentation for sge.StellarClass.event_collision for more information.
Left mouse collision event.
Proxy for sge.game.mouse.event_collision_left. See the documentation for sge.StellarClass.event_collision_left for more information.
Right mouse collision event.
Proxy for sge.game.mouse.event_collision_right. See the documentation for sge.StellarClass.event_collision_right for more information.
Top mouse collision event.
Proxy for sge.game.mouse.event_collision_top. See the documentation for sge.StellarClass.event_collision_top for more information.
Bottom mouse collision event.
Proxy for sge.game.mouse.event_collision_bottom. See the documentation for sge.StellarClass.event_collision_bottom for more information.
Key press event when paused.
See the documentation for Game.event_key_press for more information.
Key release event when paused.
See the documentation for Game.event_key_release for more information.
Mouse move event when paused.
See the documentation for Game.event_mouse_move for more information.
Mouse button press event when paused.
See the documentation for Game.event_mouse_button_press for more information.
Mouse button release event when paused.
See the documentation for Game.event_mouse_button_release for more information.
Joystick axis move event when paused.
See the documentation for Game.event_joystick_axis_move for more information.
Joystick HAT move event when paused.
See the documentation for Game.event_joystick_hat_move for more information.
Joystick trackball move event when paused.
See the documentation for Game.event_joystick_trackball_move for more information.
Joystick button press event when paused.
See the documentation for Game.event_joystick_button_press for more information.
Joystick button release event when paused.
See the documentation for Game.event_joystick_button_release for more information.
Close event when paused.
See the documentation for Game.event_close for more information.