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.15.tar.gz
(32.2 kB
view details)
Built Distribution
coopgame-0.15-py3-none-any.whl
(46.1 kB
view details)
File details
Details for the file coopgame-0.15.tar.gz
.
File metadata
- Download URL: coopgame-0.15.tar.gz
- Upload date:
- Size: 32.2 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 | 38fc2518daf9e20932c21a87415cc1d2c38a88442705e4a13b0d6f4c30eadb1b |
|
MD5 | 75104c96f550b02f43c6d2d1263fdf80 |
|
BLAKE2b-256 | 2d5ee753506204892e881a07ab4ce29e5133750615983b96bf0b0f811057d82f |
File details
Details for the file coopgame-0.15-py3-none-any.whl
.
File metadata
- Download URL: coopgame-0.15-py3-none-any.whl
- Upload date:
- Size: 46.1 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 | a4f96c81d2f67d05b8731a090ef997bdeba31b3d38765eb8b2dc61cba0777450 |
|
MD5 | 8f87115d96957251bf4e01a0659d0a3c |
|
BLAKE2b-256 | c324a04537af2d0b60b957b3c0133bbc1b614514aac03bbcb3d5cfb68c73a085 |