Return to repo list

heart-of-gold

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

commit a07588c18c895c528cf03d21691d4111fead6c08
parent e7365e74b5d4423e2a6ea3b12118e6404e06a287
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sun,  6 Sep 2020 09:04:23 -0500

Added board.py for play board

Diffstat:
Asrc/board.py | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/board.py b/src/board.py @@ -0,0 +1,31 @@ +import pygame, pytmx + +############ +# board.py # +############ + +# This file contains: +# 1. The Board class, which represents a grid of Tile objects and is the play area + +############################ +# Section 1 - Board Object # +############################ + +class Board(object): + """ + Board is a manager object for tiles. It maintains a grid of + tiles that represent the play area, and handles things like + creating these tiles, telling them what tiles they are + adjacent to, and updating the tile through its tile group. + """ + + def __init__(self, manager, filename): + + # Saved values + self.manager = manager + self.filename = filename + + # Pytmx values + self.tmx_data = pytmx.load_pygame(self.filename) + self.grid_width = self.tmx_data.width * self.tmx_data.tilewidth + self.grid_height = self.tmx_data.height * self.tmx_data.tileheight