Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Stanley <joel.stanley@adelaide.edu.au>2009-01-27 00:24:28 (GMT)
committer Joel Stanley <joel.stanley@adelaide.edu.au>2009-01-27 00:24:28 (GMT)
commit8b4e8c5d662bf126f53dfe7f41cbff573585f32b (patch)
treee1fa06e0f2011d746e8134649bf1da53579f8342
parent22ff510a1140852675924e423479e81684a21212 (diff)
Make image loading from res/ work
Images now live in the subdirectory res. For this to work, we needed to make sure the globbing outputted a file list that did not contain the directory, and that the pyglet.resource.path was set appropriatly.
-rw-r--r--ovpc.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/ovpc.py b/ovpc.py
index 38ba672..13081d3 100644
--- a/ovpc.py
+++ b/ovpc.py
@@ -14,20 +14,23 @@ window.push_handlers(keys)
batch = pyglet.graphics.Batch()
-child_death_files = glob.glob("res/child-death[012]*.png")
+pyglet.resource.path = ['res']
+pyglet.resource.reindex()
+
+child_death_files = glob.glob1("res", "child-death[012]*.png")
child_death_files.sort()
child_death = pyglet.image.Animation.from_image_sequence(
[pyglet.resource.image(x) for x in child_death_files],
0.1, False)
-raptor_anim_files = glob.glob("res/raptor[123].png")
+raptor_anim_files = glob.glob1("res", "raptor[123].png")
raptor_anim_files.sort()
raptor_anim = pyglet.image.Animation.from_image_sequence(
[pyglet.resource.image(x) for x in raptor_anim_files],
0.1, True)
pack = []
-child = pyglet.sprite.Sprite(pyglet.resource.image('res/child.png'), batch=batch)
+child = pyglet.sprite.Sprite(pyglet.resource.image('child.png'), batch=batch)
score = 0