Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
Diffstat (limited to 'game.py')
-rw-r--r--game.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/game.py b/game.py
index 27c79ac..21db535 100644
--- a/game.py
+++ b/game.py
@@ -1,15 +1,20 @@
#!/usr/bin/env python
import glucosa
+import gtk
+
+AURORA = 'images/aurora.png'
+EVENING = 'images/evening.png'
+NIGHT = 'images/night.png'
class AntFarm(glucosa.GameArea):
def __init__(self):
glucosa.GameArea.__init__(self)
-
- self.backgroud = glucosa.Image('images/backgroud.png')
+ self._set_background(NIGHT)
+
image = glucosa.Image('images/aceituna.png')
sprite = glucosa.Sprite(image, 100, 100, 18, 18, scale=2)
self.add_sprite(sprite)
@@ -17,6 +22,11 @@ class AntFarm(glucosa.GameArea):
self._events = glucosa.Events(self)
self._events.connect('mouse-moved', self._mouse_move, sprite)
+
def _mouse_move(self, widget, event, sprite):
sprite.x, sprite.y = event['x'], event['y']
+ def _set_background(self, bg):
+ alloc = self.get_allocation()
+ self.set_background(bg, alloc.width, alloc.height)
+