diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2012-10-10 19:39:52 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2012-10-10 19:39:52 (GMT) |
commit | 646dbd252787515222ad09943000ce02bdee1e2d (patch) | |
tree | 7f49e420f655ec9eeff8b15f586b8d7b9b9cebfe | |
parent | d2d4f1bd35512fc45a0cc36058d7d82e85106911 (diff) |
Add a class Head
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rwxr-xr-x[-rw-r--r--] | game.py | 21 | ||||
-rw-r--r-- | images/head.png | bin | 0 -> 6995 bytes |
2 files changed, 16 insertions, 5 deletions
@@ -1,16 +1,27 @@ #!/usr/bin/env python import glucosa +import gtk -class Snake(glucosa.GameArea): +class Game(glucosa.GameArea): def __init__(self): glucosa.GameArea.__init__(self) - image = glucosa.Image('images/head.png') - head = glucosa.Sprite(image, 100, 100, 18, 18, scale=2) - self.add_sprite(head) - + head = Head() self.add_sprite(head) + +class Head(glucosa.Sprite): + def __init__(self): + image = glucosa.Image('images/head.png') + glucosa.Sprite.__init__(self, image, 0, 0) + + pass + +if __name__ == '__main__': + w = gtk.Window() + w.add(Game()) + w.show_all() + gtk.main() diff --git a/images/head.png b/images/head.png Binary files differnew file mode 100644 index 0000000..1eea793 --- /dev/null +++ b/images/head.png |