Mercurial > rinkhals
comparison gamelib/gameboard.py @ 9:3b045083631e
Basic game board logic.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 14:52:25 +0000 |
parents | |
children | 5d58a5b13731 |
comparison
equal
deleted
inserted
replaced
8:b35794966cf3 | 9:3b045083631e |
---|---|
1 import random | |
2 | |
3 import pygame | |
4 from pgu import tilevid | |
5 | |
6 import constants | |
7 import data | |
8 | |
9 | |
10 class GameBoard(object): | |
11 TILE_DIMENSIONS = (20, 20) | |
12 | |
13 def __init__(self): | |
14 self.tv = tilevid.Tilevid() | |
15 self.tv.tga_load_tiles(data.filepath('tiles.tga'), self.TILE_DIMENSIONS) | |
16 self.tv.tga_load_level(data.filepath('level1.tga')) | |
17 | |
18 def update(self, screen): | |
19 return self.tv.update(screen) | |
20 | |
21 def loop(self): | |
22 x = random.randint(0, self.size[0]-1) | |
23 y = random.randint(0, self.size[1]-1) | |
24 tile = random.randint(0, 4) | |
25 self.tv.set((x, y), tile) | |
26 |