Tooling and templates used for building games
Project description
coopgame
Library of tooling and templates used for building games
Example:
from coopgame.gameTemplate import GameTemplate
from coopstructs.vectors import Vector2
import pygame
from coopgame.colors import Color
from coopgame.sprites import RectangleSprite
class MyGame(GameTemplate):
def __init__(self):
super().__init__()
self.sprites = pygame.sprite.Group()
def draw(self, frames):
for entity in self.sprites:
self.screen.blit(entity.surf, entity.rect)
def handle_hover_over(self, mouse_pos_as_vector: Vector2):
pass
def handle_left_click(self):
self.sprites.add(RectangleSprite(self.mouse_pos_as_vector(), Color.BLUE, 10, 10))
def handle_right_click(self):
self.sprites.add(RectangleSprite(self.mouse_pos_as_vector(), Color.RED, 20, 30))
def handle_key_pressed(self, pressed_key):
if pressed_key == pygame.K_r:
self.sprites.empty()
if __name__ == "__main__":
import logging
import loggingConfig
loggingConfig.initLogging(loggingLvl=logging.DEBUG)
game = MyGame()
game.main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coopgame-0.7.tar.gz
(16.9 kB
view details)
Built Distribution
coopgame-0.7-py3-none-any.whl
(20.3 kB
view details)
File details
Details for the file coopgame-0.7.tar.gz
.
File metadata
- Download URL: coopgame-0.7.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7cc67d5985cd1d1fbe0bf632330cf57a4bc2026c9342410e1e46ca9409566a4 |
|
MD5 | 3b4eca95cc439fa16093a3737cb9188d |
|
BLAKE2b-256 | 64b41756863d3c2ca47a15f6d25fc825e6b6c2f90f7f519a2703fa65c6604000 |
File details
Details for the file coopgame-0.7-py3-none-any.whl
.
File metadata
- Download URL: coopgame-0.7-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68a65d7e886ef2ea94bbdf5aaf99d39f9e145d16ce197ab0628c0e1c80ab41df |
|
MD5 | 1f54187a8d508c1e32136db582306bcf |
|
BLAKE2b-256 | f6d0b4a42d134e60fa359199f53cba33cea3990bf81a1f63a5918f46362e078d |