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-0.8.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

coopgame-0.8-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for coopgame-0.8.tar.gz
Algorithm Hash digest
SHA256 b32330b1e731f8568edad431df5a3a536d01e0edd1869fad5867f1e15364ea21
MD5 b8b2d29bafdd39498f2dcca62a08f2d2
BLAKE2b-256 0c09032cd92feea06c7634b35102107a7ab0a9267388b21b977f186f43622069

See more details on using hashes here.

File details

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

File metadata

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

Hashes for coopgame-0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc4a0cea69ae1243dc944ae8b044c1e279f1e8463881b44530c5b326f21f7f4
MD5 2a34e267889af74f844a6f73d0082180
BLAKE2b-256 cfff4609079c35f3be875f7ab200c3d40cb4561a05154c889263f7b4fe2f3432

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