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

Uploaded Source

Built Distribution

coopgame-0.2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for coopgame-0.2.tar.gz
Algorithm Hash digest
SHA256 a47bc98ae209ac1cc6eb1e853fcc1c61bb82d03cd10c33da5ec67866c00a9d9e
MD5 161db3d7636cd55a7a73ad049e666c7e
BLAKE2b-256 36499874b127eed427c7ce87892fcd3477b6be89a5ccf3f3e33c4d604c7650a8

See more details on using hashes here.

File details

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

File metadata

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

Hashes for coopgame-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef26168b12657fdef889a8041cf8754f8cfda32d94289348522149427b41771
MD5 fe71e5e2d515cbaa13f2a88669ab12ae
BLAKE2b-256 cfbe2cfddbca33469d3ad5900827646c0858b8818a7e9644ef46f0e69f2c390e

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