Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 22eae06261d551cbcc65fce382bfc86e48be38cc
parent 1996cb7e1ed8041cad03ccd881b3364c06501490
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Fri, 21 Aug 2020 15:24:08 -0500

VGO reformatting

Diffstat:
Msrc/vgo.py | 24++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/vgo.py b/src/vgo.py @@ -1,6 +1,6 @@ import pygame -class Entity(pygame.sprite.Sprite): +class VisibleGameObject(pygame.sprite.Sprite): """ Extended sprite class used throughout game. """ @@ -21,7 +21,10 @@ class Entity(pygame.sprite.Sprite): if surface != None: surface.blit(self.image, self.rect) -class Tile(Entity): +############################################################################### +############################################################################### + +class Tile(VisibleGameObject): def __init__(self, image, pos, passable, occupant = None): @@ -29,3 +32,20 @@ class Tile(Entity): self.passable = passable self.occupant = occupant + +############################################################################### +############################################################################### + +class Entity(VisibleGameObject): + """ + Class representing non-tile, non-UI visible + game objects (player characters, obstacles, etc). + """ + + def __init__(self, image, pos, tile = None, solid = False): + + super().__init__(image, pos) + + self.tile = tile + self.solid = solid +