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>2008-12-07 11:27:21 (GMT)
committer Joel Stanley <joel.stanley@adelaide.edu.au>2008-12-07 11:27:21 (GMT)
commit302f21f5fe890de437416b03293168d325670d58 (patch)
treefec7fd2f04211b9cc79f290acaabbdd5640ebab1
parent3023c01dc6f3b6fc5ec74a3139ccb45320581702 (diff)
keep child on the playing field
-rw-r--r--ovpc.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ovpc.py b/ovpc.py
index f14e4ea..5636469 100644
--- a/ovpc.py
+++ b/ovpc.py
@@ -26,13 +26,23 @@ def update(dt):
sys.exit(0)
if keys[key.UP]:
- child.y += dt * 200
+ child.y += dt * 100
if keys[key.DOWN]:
- child.y -= dt * 200
+ child.y -= dt * 100
if keys[key.LEFT]:
- child.x -= dt * 200
+ child.x -= dt * 100
if keys[key.RIGHT]:
- child.x += dt * 200
+ child.x += dt * 100
+
+ if child.x > window.width:
+ child.x = window.width
+ if child.x < 0:
+ child.x = 0
+
+ if child.y > window.height - child.height:
+ child.y = window.height - child.height
+ if child.y < 0:
+ child.y = 0
for raptor in raptors:
if raptor.x < (0 - raptor.width):