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

Uploaded Source

Built Distribution

coopgame-0.14-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopgame-0.14.tar.gz
  • Upload date:
  • Size: 19.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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for coopgame-0.14.tar.gz
Algorithm Hash digest
SHA256 97c8891911da0a18e528b68a4b33c526e25d83587ef6658b3746e14c471df985
MD5 1e062119917ff43b743c9399d2b2f1f3
BLAKE2b-256 518d90ca7e74628065e01cd8ecdc196ea31c636d0c946cb0315096dabb9c7f74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopgame-0.14-py3-none-any.whl
  • Upload date:
  • Size: 27.2 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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 6fc34da20f495c698d7b0ee6acfa66597dae28df48307cc5391b4e7267d41a96
MD5 8725eac25b6121c0c22aa579db81c181
BLAKE2b-256 f43a261024f4eb80dd62f261026e8f3efbf4f965fb9a3013cbe019544dce6f69

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