Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coopgame-1.7.tar.gz (79.2 kB view details)

Uploaded Source

Built Distribution

coopgame-1.7-py3-none-any.whl (102.1 kB view details)

Uploaded Python 3

File details

Details for the file coopgame-1.7.tar.gz.

File metadata

  • Download URL: coopgame-1.7.tar.gz
  • Upload date:
  • Size: 79.2 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

Hashes for coopgame-1.7.tar.gz
Algorithm Hash digest
SHA256 57ee370643a4db29bc07a35951460cafb4b5f86ccccdd0cfa81a2157a61f534a
MD5 42eb50c1e81d36fbf88e9c71de6bfcb0
BLAKE2b-256 5c3c30d178a45f23e336ff46463e848f0397e7ec8fdf385664ced4a51c697c03

See more details on using hashes here.

File details

Details for the file coopgame-1.7-py3-none-any.whl.

File metadata

  • Download URL: coopgame-1.7-py3-none-any.whl
  • Upload date:
  • Size: 102.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

Hashes for coopgame-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9a2cdd1b7d6a565603df195cb1164f9686f4fc3509c33e9f2ab4f99797a66617
MD5 22c7c7795e96ea796fbfc98acb198612
BLAKE2b-256 1b6ffec80da585d28e230af4fdeae91c6b78671d715c7fb27ec1964dd113190a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page