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.26.tar.gz
(47.6 kB
view details)
Built Distribution
coopgame-0.26-py3-none-any.whl
(62.1 kB
view details)
File details
Details for the file coopgame-0.26.tar.gz
.
File metadata
- Download URL: coopgame-0.26.tar.gz
- Upload date:
- Size: 47.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abe7a2b0cb4d0842b32634589f1620d6f4cbfa10205cfd29af9d6b4c61ce9af |
|
MD5 | 6976a82adc34333df7429cf7330c690d |
|
BLAKE2b-256 | f1bd926a75460da61020cefefcb32802253d1ab4cedb0611c537e4e48a472924 |
File details
Details for the file coopgame-0.26-py3-none-any.whl
.
File metadata
- Download URL: coopgame-0.26-py3-none-any.whl
- Upload date:
- Size: 62.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dedb25bb95c162f18c21c36f53d9db1173808acb556844a698156b5f906ae039 |
|
MD5 | d5b9098dad81d890a1078ed31a2bf1e0 |
|
BLAKE2b-256 | ebc4215c7a108608567eb788f4ef4175bb79d9c5f12dabda3b8a583d4596b182 |