data/states/town.py (view raw)
1__author__ = 'justinarmstrong'
2
3import os
4import pygame as pg
5from .. import setup, tools, tmx
6from .. import constants as c
7
8class Town(tools._State):
9 def __init__(self):
10 super(Town, self).__init__()
11
12 def startup(self, current_time, persist):
13 """Called when the State object is created"""
14 self.persist = persist
15 self.current_time = current_time
16 self.tilemap = tmx.load(('map.tmx'),
17 (800, 600))
18 self.background = setup.GFX['town_background']
19
20
21 def update(self, surface, keys, current_time):
22 """Updates state"""
23 self.keys = keys
24 self.current_time = current_time
25 self.tilemap.update(60)
26 surface.blit(self.background, (0, 0))
27 self.tilemap.draw(surface)