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.11.tar.gz
(19.1 kB
view details)
Built Distribution
coopgame-0.11-py3-none-any.whl
(22.5 kB
view details)
File details
Details for the file coopgame-0.11.tar.gz
.
File metadata
- Download URL: coopgame-0.11.tar.gz
- Upload date:
- Size: 19.1 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 | a28e9c4910fbb98fe525573a4859cd160e1a1faf312109f40ab4a135a91b9a42 |
|
MD5 | 71de624fb03dbede4dc3200e508fc59a |
|
BLAKE2b-256 | 818b6c52701ef9ee4abffa49ecafe002060d369b015dc76aa877ce44c073179b |
File details
Details for the file coopgame-0.11-py3-none-any.whl
.
File metadata
- Download URL: coopgame-0.11-py3-none-any.whl
- Upload date:
- Size: 22.5 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 | 7307b75c1ee4282d2cd6bf9caac9de0f4068ca32d977c62c13f9991d00e60057 |
|
MD5 | 3a99d0b92aea36bbf9c5ed9d5854cdd6 |
|
BLAKE2b-256 | 8ac2bdc703d2c602f6c6581d67f3e78493244589c59039a87a888a6fe8660f60 |