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.5.tar.gz
(8.6 kB
view details)
Built Distribution
coopgame-0.5-py3-none-any.whl
(10.0 kB
view details)
File details
Details for the file coopgame-0.5.tar.gz
.
File metadata
- Download URL: coopgame-0.5.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 708715432deb112737aff918f0a546160f313da9a22f4a4c677d0dfec43c680e |
|
MD5 | 5bfbffc3d05f42aa2bd739bd961f7781 |
|
BLAKE2b-256 | 1150612bd2aa07f7049e923574bc90fc102d45267ee611a7cc645d5cc8b5681e |
File details
Details for the file coopgame-0.5-py3-none-any.whl
.
File metadata
- Download URL: coopgame-0.5-py3-none-any.whl
- Upload date:
- Size: 10.0 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/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d21d1beee79552dac1a3117af040951f62b98cdd260d20de6d14f4def63a5d9e |
|
MD5 | 576fc919f27e4bc19b8941b62583c95b |
|
BLAKE2b-256 | fc86e37f408f1a4e20c03b5ce340c8d99fff2fceedd8545a4112c97a5b0a3842 |