Bridges-Python 3.5.1
Bridges(Python API)
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | Properties | List of all members
bridges.non_blocking_game.NonBlockingGame Class Reference

This class provides the features necessary to implement simple non blocking games. More...

Inheritance diagram for bridges.non_blocking_game.NonBlockingGame:
bridges.gamebase.GameBase

Public Member Functions

 __init__ (self, assid, login, apikey, rows, cols, debug=False)
 PROTECTED constructor prevents the object from being directly created.
 
 sleep_timer (self, timems=None)
 
 control_framerate (self)
 
 start (self)
 Call this function from main to start game.
 
 key_left (self)
 Is 'left' arrow key currently pressed?
 
 key_left_just_pressed (self)
 indicates whether the Left key has just been pressed this current frame
 
 key_left_still_pressed (self)
 indicates whether the Left key is still being pressed this current frame
 
 key_left_just_not_pressed (self)
 indicates whether the Left key has just been released this current frame
 
 key_left_still_not_pressed (self)
 indicates whether the Left key is not pressed and has not been pressed for more than a frame
 
 key_left_fire (self)
 indicates whether the current frame is a fire frame for the Left key
 
 key_left_setup_fire (self, int f)
 
 key_right (self)
 Is 'right' arrow currently pressed?
 
 key_right_just_pressed (self)
 indicates whether the Right key has just been pressed this current frame
 
 key_right_still_pressed (self)
 indicates whether the Right key is still being pressed this current frame
 
 key_right_just_not_pressed (self)
 indicates whether the Right key has just been released this current frame
 
 key_right_still_not_pressed (self)
 indicates whether the Right key is not pressed and has not been pressed for more than a frame
 
 key_right_fire (self)
 indicates whether the current frame is a fire frame for the Right key
 
 key_right_setup_fire (self, int f)
 
 key_up (self)
 Is 'up' arrow currently pressed?
 
 key_up_just_pressed (self)
 indicates whether the Up key has just been pressed this current frame
 
 key_up_still_pressed (self)
 indicates whether the Up key is still being pressed this current frame
 
 key_up_just_not_pressed (self)
 indicates whether the Up key has just been released this current frame
 
 key_up_still_not_pressed (self)
 indicates whether the Up key is not pressed and has not been pressed for more than a frame
 
 key_up_fire (self)
 indicates whether the current frame is a fire frame for the Up key
 
 key_up_setup_fire (self, int f)
 
 key_down (self)
 Is 'down' arrow key currently pressed?
 
 key_down_just_pressed (self)
 indicates whether the Down key has just been pressed this current frame
 
 key_down_still_pressed (self)
 indicates whether the Down key is still being pressed this current frame
 
 key_down_just_not_pressed (self)
 indicates whether the Down key has just been released this current frame
 
 key_down_still_not_pressed (self)
 indicates whether the Down key is not pressed and has not been pressed for more than a frame
 
 key_down_fire (self)
 indicates whether the current frame is a fire frame for the Down key
 
 key_down_setup_fire (self, int f)
 
 key_q (self)
 Is 'q' currently pressed?
 
 key_q_just_pressed (self)
 indicates whether the Q key has just been pressed this current frame
 
 key_q_still_pressed (self)
 indicates whether the Q key is still being pressed this current frame
 
 key_q_just_not_pressed (self)
 indicates whether the Q key has just been released this current frame
 
 key_q_still_not_pressed (self)
 indicates whether the Q key is not pressed and has not been pressed for more than a frame
 
 key_q_fire (self)
 indicates whether the current frame is a fire frame for the Q key
 
 key_q_setup_fire (self, int f)
 
 key_space (self)
 Is 'space' key currently pressed?
 
 key_space_just_pressed (self)
 indicates whether the Space key has just been pressed this current frame
 
 key_space_still_pressed (self)
 indicates whether the Space key is still being pressed this current frame
 
 key_space_just_not_pressed (self)
 indicates whether the Space key has just been released this current frame
 
 key_space_still_not_pressed (self)
 indicates whether the Space key is not pressed and has not been pressed for more than a frame
 
 key_space_fire (self)
 indicates whether the current frame is a fire frame for the Space key
 
 key_space_setup_fire (self, int f)
 
 key_w (self)
 Is 'w' currently pressed?
 
 key_w_just_pressed (self)
 indicates whether the W key has just been pressed this current frame
 
 key_w_still_pressed (self)
 indicates whether the W key is still being pressed this current frame
 
 key_w_just_not_pressed (self)
 indicates whether the W key has just been released this current frame
 
 key_w_still_not_pressed (self)
 indicates whether the W key is not pressed and has not been pressed for more than a frame
 
 key_w_fire (self)
 indicates whether the current frame is a fire frame for the W key
 
 key_w_setup_fire (self, int f)
 
 key_a (self)
 Is 'a' currently pressed?
 
 key_a_just_pressed (self)
 indicates whether the A key has just been pressed this current frame
 
 key_a_still_pressed (self)
 indicates whether the A key is still being pressed this current frame
 
 key_a_just_not_pressed (self)
 indicates whether the A key has just been released this current frame
 
 key_a_still_not_pressed (self)
 indicates whether the A key is not pressed and has not been pressed for more than a frame
 
 key_a_fire (self)
 indicates whether the current frame is a fire frame for the A key
 
 key_a_setup_fire (self, int f)
 
 key_s (self)
 Is 's' key currently pressed?
 
 key_s_just_pressed (self)
 indicates whether the S key has just been pressed this current frame
 
 key_s_still_pressed (self)
 indicates whether the S key is still being pressed this current frame
 
 key_s_just_not_pressed (self)
 indicates whether the S key has just been released this current frame
 
 key_s_still_not_pressed (self)
 indicates whether the S key is not pressed and has not been pressed for more than a frame
 
 key_s_fire (self)
 indicates whether the current frame is a fire frame for the S key
 
 key_s_setup_fire (self, int f)
 
 key_d (self)
 Is 'd' key currently pressed?
 
 key_d_just_pressed (self)
 indicates whether the D key has just been pressed this current frame
 
 key_d_still_pressed (self)
 indicates whether the D key is still being pressed this current frame
 
 key_d_just_not_pressed (self)
 indicates whether the D key has just been released this current frame
 
 key_d_still_not_pressed (self)
 indicates whether the D key is not pressed and has not been pressed for more than a frame
 
 key_d_fire (self)
 indicates whether the current frame is a fire frame for the D key
 
 key_d_setup_fire (self, int f)
 
- Public Member Functions inherited from bridges.gamebase.GameBase
 game_base_init (self, id, log, key, rows, cols, debug=False)
 Initializes the gamebase object.
 
 close (self)
 close the socket connection (and game)
 
 register_keypress (self, kl)
 
 initialize (self)
 
 game_loop (self)
 
 quit (self)
 calling this function causes the game to end.
 
 set_title (self, title)
 sets title of game
 
 set_description (self, desc)
 sets description of the game
 
 get_bg_color (self, row, col)
 gets background color of a cell
 
 set_bg_color (self, row, col, color)
 sets background color of a cell
 
 get_symbol (self, row, col)
 gets symbol of the cell at row, col
 
 get_symbol_color (self, row, col)
 gets symbol color of the cell at row, col
 
 draw_symbol (self, row, col, s, c)
 draw symbol s with color col at cell (row, col)
 
 render (self)
 renders the board
 

Public Attributes

 time_of_last_frame
 
 ih
 
 upSM
 
 downSM
 
 leftSM
 
 rightSM
 
 qSM
 
 spaceSM
 
 wSM
 
 aSM
 
 sSM
 
 dSM
 
 game_started
 
- Public Attributes inherited from bridges.gamebase.GameBase
 grid_state
 
 debug
 
 firsttime
 
 bridges
 
 grid
 
 sock
 
 game_started
 

Protected Attributes

 _fps
 

Properties

 fps = property
 Get the frame rate at which the game running.
 
- Properties inherited from bridges.gamebase.GameBase
 board_width = property
 setter/getter property for board width
 
 board_height = property
 setter/getter property for board height
 

Additional Inherited Members

- Static Public Attributes inherited from bridges.gamebase.GameBase
bool debug = True
 

Detailed Description

This class provides the features necessary to implement simple non blocking games.

The games that can be created out of NonBlockingGame are based on a simple board grid of at most 2304 cells (e.g., 48x48, or any combinations less than 2304 cells). Each cell has a background color, and a colored symbol.

This class is used by having another class derive from it and implement the two functions: initialize() and GameLoop(). initialize() is called exactly once, on the first frame of the game. It is used to make first time initializations of the game state (such as setting the board in its initial position, for instance in chess). However, GameLoop() is called at every frame of the game. The game starts when the function start() is called on the object you created.

This game does not do anything, but it is the minimal code that will run a game. Note that the constructor of my_game passes 3 parameters to the constructor of NonBlockingGame(). These three parameters are the classic parameters that the constructor of bridges::Bridges takes (e.g., assignmentID, username, apikey).

To change the board, two functions are used. setBGColor() change the background color of a particular cell. It takes three parameters, the first two identify the cell of the board to change, and the last one is a color from a color palette provided by NamedColor. drawSymbol() takes four parameters, the first two identify the cell of the board to change, the third is a symbol from a symbol palette provided by NamedSymbol, the fourth is the color that symbol shold be drawn in and provided by NamedColor.

For instance, a very simple initialize() could look like:

def initialize():
set_bg_color(0, 0, NamedColor.lightsalmon);
@code
draw_symbol(0, 0, NamedSymbol.sword, NamedColor.blue);

Note that the size of the board is set by default at 10x10 and that drawing on a cell that does not exist will lead to an error. One can specify a gameboard of a different size by passing additional parameters to the NonBlockingGame constructor. However, the game can not be more than 2034 cells in total, so a 15x15 board is possible, a 48x48 board is the largest square board possible, and a rectangular 96x24 rectangular board is also possible. But a 200x20 board would be 4000 cells and is not possible. For instance a board of 16 rows and 64 columns can be created defining the my_game constructor as:

@code
my_game = NonBlockingGame (1, "myuserid", "myapikey", 16, 64)

The bridges game engine will call the GameLoop() function at each frame of the game. You can write this function to modify the state of the game board using setBGColor() and drawSymbol(). For instance, the following GameLoop() will color the board randomly one cell at a time.

def game_loop():
set_BG_Color(rand()%10, rand()%10, NamedColor.lightsalmon);

The gameLoop can also probe the state of some keys of the keyboard using functions key_up(), key_left(),

key_down(), key_right(), key_w(), key_a(), key_s(),

key_d(), key_space(), and key_q(). These functions return a boolean that indicate whether the key is pressed at that frame or not. For instance, the following code will only color the board randomly when the up arrow is pressed.

def game_loop():
if key_up():
@code
set_bg_color(rand()%10, rand()%10, NamedColor.lightsalmon);

The previous way will have an action executed at each frame of the game if the key stays pressed. This could be cumbersome for some games and you may want a key press to be triggered with a cooldown (so that it activates only every so many frames). You can configure how many frames will pass between two activations of the key with keyUpSetupFire() and you can tell whether it is a fire frame with keyUpFire(). There are similar functions for all keys that are recognized by Bridges. See the following code for a simple usage:

def initialize() override:
@code
keyUpSetupFire(20);

gameLoop(): if # will only be true once every 20 frames

setBGColor(rand()%10, rand()%10, NamedColor.lightsalmon);

Bridges supports a third way to use inputs that enables you to know the first frame a key is pressed and the first frame a key is no longer pressed. You can also know whether a key is still being pressed (after the first frame it is being pressed) and whether it is still not pressed (after the first frame it is no longer pressed). The four functions are keyUpJustPressed(),

keyUpStillPressed(), keyUpJustNotPressed(),

keyUpStillNotPressed(). The following code examplifies the usage of these functions.

gameLoop():
if (keyUpJustPressed()):
setBGColor(0, 0, NamedColor.lightsalmon);
if (keyUpStillPressed()):
setBGColor(0, 1, NamedColor.lightsalmon);
if (keyUpJustNotPressed()):
setBGColor(0, 2, NamedColor.lightsalmon);
if (keyUpStillNotPressed()):
setBGColor(0, 3, NamedColor.lightsalmon);
Author
Erik Saule
Date
7-21-19, 1-12-23
See also
NonBlockingGame tutorial at: https://bridgesuncc.github.io/tutorials/NonBlockingGame.html

Constructor & Destructor Documentation

◆ __init__()

bridges.non_blocking_game.NonBlockingGame.__init__ (   self,
  assid,
  login,
  apikey,
  rows,
  cols,
  debug = False 
)

PROTECTED constructor prevents the object from being directly created.

Since GameBase is meant to be a purely internal class, that seems appropriate.

Parameters
assidassignment number
loginuser name
apikeyauthentication id
rowsheight of game grid
colswidth of game grid
Returns
None

Reimplemented from bridges.gamebase.GameBase.

Member Function Documentation

◆ control_framerate()

bridges.non_blocking_game.NonBlockingGame.control_framerate (   self)

◆ key_a()

bridges.non_blocking_game.NonBlockingGame.key_a (   self)

Is 'a' currently pressed?

Returns
true if 'a' is currently pressed

◆ key_a_fire()

bridges.non_blocking_game.NonBlockingGame.key_a_fire (   self)

indicates whether the current frame is a fire frame for the A key

◆ key_a_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_a_just_not_pressed (   self)

indicates whether the A key has just been released this current frame

◆ key_a_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_a_just_pressed (   self)

indicates whether the A key has just been pressed this current frame

◆ key_a_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_a_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_a_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_a_still_not_pressed (   self)

indicates whether the A key is not pressed and has not been pressed for more than a frame

◆ key_a_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_a_still_pressed (   self)

indicates whether the A key is still being pressed this current frame

◆ key_d()

bridges.non_blocking_game.NonBlockingGame.key_d (   self)

Is 'd' key currently pressed?

Returns
true 'd' is currently pressed

◆ key_d_fire()

bridges.non_blocking_game.NonBlockingGame.key_d_fire (   self)

indicates whether the current frame is a fire frame for the D key

◆ key_d_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_d_just_not_pressed (   self)

indicates whether the D key has just been released this current frame

◆ key_d_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_d_just_pressed (   self)

indicates whether the D key has just been pressed this current frame

◆ key_d_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_d_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_d_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_d_still_not_pressed (   self)

indicates whether the D key is not pressed and has not been pressed for more than a frame

◆ key_d_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_d_still_pressed (   self)

indicates whether the D key is still being pressed this current frame

◆ key_down()

bridges.non_blocking_game.NonBlockingGame.key_down (   self)

Is 'down' arrow key currently pressed?

Returns
true if 'down' arrow key is currently pressed

◆ key_down_fire()

bridges.non_blocking_game.NonBlockingGame.key_down_fire (   self)

indicates whether the current frame is a fire frame for the Down key

◆ key_down_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_down_just_not_pressed (   self)

indicates whether the Down key has just been released this current frame

◆ key_down_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_down_just_pressed (   self)

indicates whether the Down key has just been pressed this current frame

◆ key_down_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_down_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_down_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_down_still_not_pressed (   self)

indicates whether the Down key is not pressed and has not been pressed for more than a frame

◆ key_down_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_down_still_pressed (   self)

indicates whether the Down key is still being pressed this current frame

◆ key_left()

bridges.non_blocking_game.NonBlockingGame.key_left (   self)

Is 'left' arrow key currently pressed?

Returns
true if 'left' arrow key is currently pressed

◆ key_left_fire()

bridges.non_blocking_game.NonBlockingGame.key_left_fire (   self)

indicates whether the current frame is a fire frame for the Left key

◆ key_left_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_left_just_not_pressed (   self)

indicates whether the Left key has just been released this current frame

◆ key_left_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_left_just_pressed (   self)

indicates whether the Left key has just been pressed this current frame

◆ key_left_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_left_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_left_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_left_still_not_pressed (   self)

indicates whether the Left key is not pressed and has not been pressed for more than a frame

◆ key_left_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_left_still_pressed (   self)

indicates whether the Left key is still being pressed this current frame

◆ key_q()

bridges.non_blocking_game.NonBlockingGame.key_q (   self)

Is 'q' currently pressed?

Returns
true if 'q' is currently pressed

◆ key_q_fire()

bridges.non_blocking_game.NonBlockingGame.key_q_fire (   self)

indicates whether the current frame is a fire frame for the Q key

◆ key_q_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_q_just_not_pressed (   self)

indicates whether the Q key has just been released this current frame

◆ key_q_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_q_just_pressed (   self)

indicates whether the Q key has just been pressed this current frame

◆ key_q_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_q_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_q_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_q_still_not_pressed (   self)

indicates whether the Q key is not pressed and has not been pressed for more than a frame

◆ key_q_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_q_still_pressed (   self)

indicates whether the Q key is still being pressed this current frame

◆ key_right()

bridges.non_blocking_game.NonBlockingGame.key_right (   self)

Is 'right' arrow currently pressed?

Returns
true if 'right' arrow key is currently pressed

◆ key_right_fire()

bridges.non_blocking_game.NonBlockingGame.key_right_fire (   self)

indicates whether the current frame is a fire frame for the Right key

◆ key_right_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_right_just_not_pressed (   self)

indicates whether the Right key has just been released this current frame

◆ key_right_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_right_just_pressed (   self)

indicates whether the Right key has just been pressed this current frame

◆ key_right_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_right_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_right_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_right_still_not_pressed (   self)

indicates whether the Right key is not pressed and has not been pressed for more than a frame

◆ key_right_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_right_still_pressed (   self)

indicates whether the Right key is still being pressed this current frame

◆ key_s()

bridges.non_blocking_game.NonBlockingGame.key_s (   self)

Is 's' key currently pressed?

Returns
true if 's' is currently pressed

◆ key_s_fire()

bridges.non_blocking_game.NonBlockingGame.key_s_fire (   self)

indicates whether the current frame is a fire frame for the S key

◆ key_s_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_s_just_not_pressed (   self)

indicates whether the S key has just been released this current frame

◆ key_s_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_s_just_pressed (   self)

indicates whether the S key has just been pressed this current frame

◆ key_s_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_s_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_s_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_s_still_not_pressed (   self)

indicates whether the S key is not pressed and has not been pressed for more than a frame

◆ key_s_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_s_still_pressed (   self)

indicates whether the S key is still being pressed this current frame

◆ key_space()

bridges.non_blocking_game.NonBlockingGame.key_space (   self)

Is 'space' key currently pressed?

Returns
true if 'space' key is currently pressed

◆ key_space_fire()

bridges.non_blocking_game.NonBlockingGame.key_space_fire (   self)

indicates whether the current frame is a fire frame for the Space key

◆ key_space_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_space_just_not_pressed (   self)

indicates whether the Space key has just been released this current frame

◆ key_space_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_space_just_pressed (   self)

indicates whether the Space key has just been pressed this current frame

◆ key_space_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_space_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_space_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_space_still_not_pressed (   self)

indicates whether the Space key is not pressed and has not been pressed for more than a frame

◆ key_space_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_space_still_pressed (   self)

indicates whether the Space key is still being pressed this current frame

◆ key_up()

bridges.non_blocking_game.NonBlockingGame.key_up (   self)

Is 'up' arrow currently pressed?

Returns
true if 'up' arrow key is currently pressed

◆ key_up_fire()

bridges.non_blocking_game.NonBlockingGame.key_up_fire (   self)

indicates whether the current frame is a fire frame for the Up key

◆ key_up_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_up_just_not_pressed (   self)

indicates whether the Up key has just been released this current frame

◆ key_up_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_up_just_pressed (   self)

indicates whether the Up key has just been pressed this current frame

◆ key_up_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_up_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_up_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_up_still_not_pressed (   self)

indicates whether the Up key is not pressed and has not been pressed for more than a frame

◆ key_up_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_up_still_pressed (   self)

indicates whether the Up key is still being pressed this current frame

◆ key_w()

bridges.non_blocking_game.NonBlockingGame.key_w (   self)

Is 'w' currently pressed?

Returns
true if 'w' is currently pressed

◆ key_w_fire()

bridges.non_blocking_game.NonBlockingGame.key_w_fire (   self)

indicates whether the current frame is a fire frame for the W key

◆ key_w_just_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_w_just_not_pressed (   self)

indicates whether the W key has just been released this current frame

◆ key_w_just_pressed()

bridges.non_blocking_game.NonBlockingGame.key_w_just_pressed (   self)

indicates whether the W key has just been pressed this current frame

◆ key_w_setup_fire()

bridges.non_blocking_game.NonBlockingGame.key_w_setup_fire (   self,
int  f 
)
Parameters
fhow many frames between two fire events

◆ key_w_still_not_pressed()

bridges.non_blocking_game.NonBlockingGame.key_w_still_not_pressed (   self)

indicates whether the W key is not pressed and has not been pressed for more than a frame

◆ key_w_still_pressed()

bridges.non_blocking_game.NonBlockingGame.key_w_still_pressed (   self)

indicates whether the W key is still being pressed this current frame

◆ sleep_timer()

bridges.non_blocking_game.NonBlockingGame.sleep_timer (   self,
  timems = None 
)

◆ start()

bridges.non_blocking_game.NonBlockingGame.start (   self)

Call this function from main to start game.

Reimplemented from bridges.gamebase.GameBase.

Member Data Documentation

◆ _fps

bridges.non_blocking_game.NonBlockingGame._fps
protected

◆ aSM

bridges.non_blocking_game.NonBlockingGame.aSM

◆ downSM

bridges.non_blocking_game.NonBlockingGame.downSM

◆ dSM

bridges.non_blocking_game.NonBlockingGame.dSM

◆ game_started

bridges.non_blocking_game.NonBlockingGame.game_started

◆ ih

bridges.non_blocking_game.NonBlockingGame.ih

◆ leftSM

bridges.non_blocking_game.NonBlockingGame.leftSM

◆ qSM

bridges.non_blocking_game.NonBlockingGame.qSM

◆ rightSM

bridges.non_blocking_game.NonBlockingGame.rightSM

◆ spaceSM

bridges.non_blocking_game.NonBlockingGame.spaceSM

◆ sSM

bridges.non_blocking_game.NonBlockingGame.sSM

◆ time_of_last_frame

bridges.non_blocking_game.NonBlockingGame.time_of_last_frame

◆ upSM

bridges.non_blocking_game.NonBlockingGame.upSM

◆ wSM

bridges.non_blocking_game.NonBlockingGame.wSM

Property Documentation

◆ fps

bridges.non_blocking_game.NonBlockingGame.fps = property
static

Get the frame rate at which the game running.

Returns
The target framerate. The game could be somewhat slower depending on how computationally expensive the gameloop is and on the speed of the network

The documentation for this class was generated from the following file: