Mercurial > sypikslang
changeset 57:9aa0252fb6e4
Tweak science buttons
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Mon, 07 May 2012 23:13:05 +0200 |
parents | 78dfd429b9a6 |
children | 52913ba12988 |
files | data/images/science_down.png data/images/science_normal.png gamelib/gamegui.py |
diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/gamegui.py Mon May 07 22:54:15 2012 +0200 +++ b/gamelib/gamegui.py Mon May 07 23:13:05 2012 +0200 @@ -3,6 +3,9 @@ """Gui for the actual game""" +from pygame import image + +from gamelib.data import filepath from gamelib.gui_base import Window from gamelib.gui import BigButton from gamelib.engine import PopWindow @@ -41,6 +44,11 @@ class ScienceWidget(BigButton): + WIDTH = 200 + + BG_IMAGE_NORMAL = image.load(filepath('images/science_normal.png')) + BG_IMAGE_DOWN = image.load(filepath('images/science_down.png')) + def __init__(self, science, pos, parent): self.science = science self.points = 0 @@ -83,13 +91,16 @@ self._sciences = [] x = 0 - y = 200 + y = 150 for science in self.game.lab.science: widget = ScienceWidget(science, (x, y), self) self.add_child(widget) self._sciences.append(widget) - x += 100 + x += 200 + if x >= WIDTH: + x = 0 + y += 100 def end_turn(self): pass