core module

Core package.

This is the “heart” of the game. All game features and functionalities are call from here, as well all the graphics rendered to the screen, are called from here. It also is responsible for creating the game window, which is obviously a STRICT requirement in order to play. ;)

core.game

Module name: game

The game module is where all game-related tasks are run.

class game.core.game.Game(window_width: int, window_height: int)

Bases: Window

Class for managing a game instance.

FONT_PATH: str = '/home/docs/checkouts/readthedocs.org/user_builds/tile-game/checkouts/latest/game/assets/font.ttf'
all_events() None

Verify for any potential pygame events and update the targeted elements accordingly.

clear(colour: tuple[int, int, int]) None

Clear the screen with the specified colour.

crash(traceback: str) None

Initiate crash screen and stop any running process. Loop until user decides to quit the application.

draw_fps() None

Update and draw the FPS on-screen.

is_running() bool

Return the running state of the game.

resize(e: pygame.event.Event) None

Update window dimensions on resize.

stop() None

Terminate the game.

tick() None

Refresh the screen and keep the in-game clock running.

toggle_fullscreen() None

Toggle between windowed mode and full-screen mode, and update the window accordingly.

update() None

Update all child objects and core of the game.

update_all_uis() None

Update all the GUI-related elements.

update_loop() None

Like the standard update loop, but only used for threaded tasks.

window_updates() None

Update window based on options’ menu.

core.window

Module name: window

Here is where the game window is created and managed. It handles game refreshes, updates from screen events (like resizing or fullscreen) and the GUI updates.

class game.core.window.Window(width: int, height: int)

Bases: object

Class for creating the window frame in which the game will be contained.

FONT_PATH: str = '/home/docs/checkouts/readthedocs.org/user_builds/tile-game/checkouts/latest/game/assets/font.ttf'
clear(colour: tuple[int, int, int]) None

Clear the screen with the specified colour.

resize(e: pygame.event.Event) None

Update window dimensions on resize.

tick() None

Refresh the screen and keep the in-game clock running.

toggle_fullscreen() None

Toggle between windowed mode and full-screen mode, and update the window accordingly.