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

Uploaded Source

Built Distribution

coopgame-0.19-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopgame-0.19.tar.gz
  • Upload date:
  • Size: 30.5 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-0.19.tar.gz
Algorithm Hash digest
SHA256 293a94af7cc6f548bae4064f59ef7407ca7f0ca66bb754b6cd86697fe9463a4e
MD5 78e5090c2a2cd7e235147d5524665a29
BLAKE2b-256 3a9b520f602577e43b6d900a23b6d0c599a898a6652c6f09bf6a08b757f3d680

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopgame-0.19-py3-none-any.whl
  • Upload date:
  • Size: 36.4 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-0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 2ec5cf8af8d3ebdc750f6e0f4b435a6ff72c17d3192dfe11606be312fa39926d
MD5 c55edb419b75bed94d0c9837fa745fa3
BLAKE2b-256 b67711eee7a6a3845dcdf97a0fb459de144b99c36db14517e431f92367ccadc1

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