Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorPootle daemon <pootle@pootle.sugarlabs.org>2011-01-20 12:14:10 (GMT)
committer Pootle daemon <pootle@pootle.sugarlabs.org>2011-01-20 12:14:10 (GMT)
commite31e66595838ef3920600f533fc138467f1f585c (patch)
tree3e4dcd429ba8b6cdcfe3041b1c13f4ec11f09566 /data
parent2a44705782f6cbe62547e4cb764175e782046f3e (diff)
parentfc634f2bc1ef52382807fa4f1d8e8ee8a160cb9e (diff)
Merge branch 'master' of git://git.sugarlabs.org/pippy/mainline
Diffstat (limited to 'data')
-rw-r--r--data/graphics/bounce32
-rw-r--r--data/graphics/camera29
-rw-r--r--data/graphics/jump6
-rw-r--r--data/graphics/lines11
-rw-r--r--data/graphics/physics16
-rw-r--r--data/graphics/pong29
-rw-r--r--data/graphics/slideshow65
-rw-r--r--data/graphics/snow11
-rw-r--r--data/graphics/tree143
-rw-r--r--data/graphics/xolympics150
-rw-r--r--data/sound/playSine2
-rw-r--r--data/sound/playWave2
-rw-r--r--data/string/thanks12
13 files changed, 304 insertions, 204 deletions
diff --git a/data/graphics/bounce b/data/graphics/bounce
index d0bcd3c..6667b14 100644
--- a/data/graphics/bounce
+++ b/data/graphics/bounce
@@ -2,7 +2,15 @@
import pippy, pygame, sys
from pygame.locals import *
-from random import *
+
+# the text to bounce around the screen
+msg = "Hello!"
+
+# the size of the text, in pixels
+fsize = 36
+
+# vector for motion, will control speed and angle
+mvect = [3, 2]
# always need to init first thing
pygame.init()
@@ -10,20 +18,12 @@ pygame.init()
# turn off cursor
pygame.mouse.set_visible(False)
-# XO screen is 1200x900
-size = width, height = 1200, 900
-
-# we'll use 36 pixel high text
-fsize = 36
-
-# vector for motion, will control speed and angle
-mvect = [3,2]
-
# create the window and keep track of the surface
# for drawing into
-screen = pygame.display.set_mode(size)
+screen = pygame.display.set_mode()
-msg = "Hello!"
+# ask for screen's width and height
+size = width, height = screen.get_size()
# create a Font object from a file, or use the default
# font if the file name is None. size param is height
@@ -35,7 +35,7 @@ font = pygame.font.Font(None, fsize)
# Font.render draws text onto a new surface.
#
# usage: Font.render(text, antialias, color, bg=None)
-text = font.render(msg, True, (10,10,10))
+text = font.render(msg, True, (10, 10, 10))
# the Rect object is used for positioning
textRect = text.get_rect()
@@ -46,6 +46,7 @@ textRect.top = 0;
while pippy.pygame.next_frame():
+ # every time we move the text, check for quit or keydown events and exit
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
@@ -53,8 +54,9 @@ while pippy.pygame.next_frame():
elif event.type == KEYDOWN:
sys.exit()
- screen.fill((250,250,250))
-
+ # fill the screen with almost white
+ screen.fill((250, 250, 250))
+
# draw the text
screen.blit(text, textRect)
diff --git a/data/graphics/camera b/data/graphics/camera
index 6eea88f..85dc606 100644
--- a/data/graphics/camera
+++ b/data/graphics/camera
@@ -1,50 +1,57 @@
-# image: take a picture
+# camera: take a picture, animate it on screen
import gst, pippy, pygame, sys, time
-from random import *
-
-# XO screen is 1200 by 900
-size = width, height = 1200, 900
# grey background
-bgcolor = (128,128,128)
+bgcolor = (128, 128, 128)
# grab a frame from camera to file
pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! filesink location=/tmp/pippypic.jpg')
pipeline.set_state(gst.STATE_PLAYING)
-# pygame always needs to be initialized as the first call
+# start using pygame
pygame.init()
# turn off cursor
pygame.mouse.set_visible(False)
-# create the pygame window at the desired size and return a Surface object for
+# create the pygame window and return a Surface object for
# drawing in that window.
-screen = pygame.display.set_mode(size)
+screen = pygame.display.set_mode()
+# pause for a second to allow the camera frame to be grabbed
time.sleep(1)
+
+# stop the camera frame grabbing
pipeline.set_state(gst.STATE_NULL)
-# load in previously grabbed frame
+# load in the grabbed camera frame
image = pygame.image.load("/tmp/pippypic.jpg")
angle = 0.0
scale = 2.0
while pippy.pygame.next_frame():
+ # every time we animate, check for quit or keydown events and exit
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
elif event.type == pygame.KEYDOWN: sys.exit()
- newImage = pygame.transform.rotozoom(image, angle,scale)
+ # rotate and scale the image
+ newImage = pygame.transform.rotozoom(image, angle, scale)
newImageRect = newImage.get_rect()
newImageRect.centerx = screen.get_rect().centerx
newImageRect.centery = screen.get_rect().centery
+ # display the rotated and scaled image
screen.fill(bgcolor)
screen.blit(newImage, newImageRect)
pygame.display.flip()
+ # choose a new rotation angle and scale
angle = angle + 5.0
scale = scale * 0.95
+
+ # finish once the scale becomes very very small
+ if scale < 0.001:
+ break
diff --git a/data/graphics/jump b/data/graphics/jump
index f74ea71..7786187 100644
--- a/data/graphics/jump
+++ b/data/graphics/jump
@@ -12,19 +12,19 @@ for i in xrange(0,50):
print "_|_"
print " "
pippy.wait()
-
+
pippy.console.clear()
print "_o_"
print " | "
print "/ \\"
pippy.wait()
-
+
pippy.console.clear()
print " o "
print "/|\\"
print "| |"
pippy.wait()
-
+
pippy.console.clear()
print "_o_"
print " | "
diff --git a/data/graphics/lines b/data/graphics/lines
index c0faf93..bb67a34 100644
--- a/data/graphics/lines
+++ b/data/graphics/lines
@@ -4,9 +4,6 @@ import pippy, pygame, sys
from pygame.locals import *
from random import *
-# XO screen is 1200x900
-size = width, height = 1200, 900
-
# always need to init first thing
pygame.init()
@@ -15,7 +12,11 @@ pygame.mouse.set_visible(False)
# create the window and keep track of the surface
# for drawing into
-screen = pygame.display.set_mode(size)
+screen = pygame.display.set_mode()
+
+# ask for screen's width and height
+size = width, height = screen.get_size()
+
# start the screen all black
screen.fill((0,0,0))
@@ -48,7 +49,7 @@ while pippy.pygame.next_frame():
pygame.display.flip()
# update the end points and the color
- for i in range(2):
+ for i in range(2):
start[i] = start[i] + mvect_start[i]
end[i] = end[i] + mvect_end[i]
diff --git a/data/graphics/physics b/data/graphics/physics
index 556442a..fbc336c 100644
--- a/data/graphics/physics
+++ b/data/graphics/physics
@@ -6,12 +6,12 @@ from pippy import physics
# initialize pygame first thing
pygame.init()
-screen = pygame.display.set_mode((1200,900))
-
+screen = pygame.display.set_mode()
+
# set up the physics world (instance of Elements)
world = physics.Elements(screen.get_size())
world.renderer.set_surface(screen)
-
+
# set up initial physics objects
world.add.ground()
world.add.ball((600,0), 50)
@@ -19,9 +19,9 @@ world.add.rect((500,0), 25, 300, dynamic=True, density=1.0, restitution=0.16, fr
# add 20 more balls
balls = 0
-while(balls<20):
- world.add.ball((balls*5+200,balls*5), 50)
- balls+=1
+while(balls < 20):
+ world.add.ball((balls*5+200, balls*5), 50)
+ balls += 1
# begin physics simulation
world.run_physics = True
@@ -46,8 +46,7 @@ while pippy.pygame.next_frame() and world.run_physics:
world.mouse_move(event.pos)
# clear display with a color
- # (r,g,b), where 0<=value<256
- screen.fill((80,160,240))
+ screen.fill((80, 160, 240))
# update & draw physics world
world.update()
@@ -55,4 +54,3 @@ while pippy.pygame.next_frame() and world.run_physics:
# update the display
pygame.display.flip()
-
diff --git a/data/graphics/pong b/data/graphics/pong
index 5916c0b..b94aeb9 100644
--- a/data/graphics/pong
+++ b/data/graphics/pong
@@ -1,7 +1,7 @@
# pong: hit the ball with the paddle
#
# use the escape key to exit
-#
+#
# on the XO, the escape key is the top lefthand key,
# circle with an x in it.
@@ -12,40 +12,40 @@ from random import *
# always need to init first thing
pygame.init()
-# XO screen is 1200x900
-size = width, height = 1200, 900
-
# create the window and keep track of the surface
# for drawing into
-screen = pygame.display.set_mode(size)
+screen = pygame.display.set_mode()
+
+# ask for screen's width and height
+size = width, height = screen.get_size()
# turn off the cursor
pygame.mouse.set_visible(False)
# turn on key repeating (repeat 40 times per second)
-pygame.key.set_repeat(25,25)
+pygame.key.set_repeat(25, 25)
# start the screen all black
-bgcolor = (0,0,0)
+bgcolor = (0, 0, 0)
screen.fill(bgcolor)
# paddle constants
paddle_width = 20
paddle_length = 100
paddle_radius = paddle_length / 2
-paddle_color = (250,250,250)
+paddle_color = (250, 250, 250)
step = 6 # paddle moves 3 pixels at a go
# ball constants
-ball_color = (250,250,250)
+ball_color = (250, 250, 250)
ball_radius = 25
# game constants
fsize = 48
msg = "Press 'g' to start game"
-font=pygame.font.Font(None, fsize)
-text = font.render(msg, True, (250,250,250))
+font = pygame.font.Font(None, fsize)
+text = font.render(msg, True, (250, 250, 250))
textRect = text.get_rect()
textRect.centerx = screen.get_rect().centerx
textRect.centery = screen.get_rect().centery
@@ -100,7 +100,7 @@ while pippy.pygame.next_frame():
or event.key == 259 \
or event.key == 258: # down
paddle_location = paddle_location + step
-
+
# make sure the paddle is in-bounds
if paddle_location - paddle_radius < 0:
paddle_location = paddle_radius
@@ -113,7 +113,7 @@ while pippy.pygame.next_frame():
# draw the paddle on the right side of the screen
pygame.draw.line(screen,
paddle_color,
- (width - paddle_width, paddle_location -
+ (width - paddle_width, paddle_location -
paddle_radius),
(width - paddle_width,
paddle_location+paddle_radius),
@@ -124,7 +124,8 @@ while pippy.pygame.next_frame():
# draw the unused balls
for i in range(balls):
- pygame.draw.circle(screen, ball_color, (int(round(30+i*ball_radius*2.4)), 30),
+ pygame.draw.circle(screen, ball_color,
+ (int(round(30+i*ball_radius*2.4)), 30),
ball_radius)
# update the display
diff --git a/data/graphics/slideshow b/data/graphics/slideshow
deleted file mode 100644
index 0d38ab8..0000000
--- a/data/graphics/slideshow
+++ /dev/null
@@ -1,65 +0,0 @@
-# slideshow: show datastore photos
-def pippy_activity_class(): return 'activity.PyGameActivity'
-if __name__ == '__main__':
- import gst, pippy, pygame, sys, time
- from pippy import query
-
- from random import *
-
- # XO screen is 1200 by 900
- size = width, height = 1200, 900
-
- # grey background
- bgcolor = (128,128,128)
-
- # Create a search dict
- search = {}
- search["mime_type"] = "image/jpeg"
-
- # Perform the search and retrieve the jobjects
- results = query.find(search)
- # XXX: Fix caching limit in query.py
- objects = results.read(15)
-
- if len(objects) == 0:
- print "No photos found."
- time.sleep(3)
- sys.exit()
-
- def get_image():
- for jobject in objects:
- yield jobject.get_file_path()
-
- next_image = get_image()
-
- # pygame always needs to be initialized as the first call
- pygame.init()
-
- # turn off cursor
- pygame.mouse.set_visible(False)
-
- # create the pygame window at the desired size and return a Surface object for
- # drawing in that window.
- screen = pygame.display.set_mode(size)
-
- # load in previously grabbed frame
- image = pygame.image.load(next_image.next())
-
- while pippy.pygame.next_frame():
- for event in pygame.event.get():
- if event.type == pygame.QUIT: sys.exit()
- elif event.type == pygame.KEYDOWN:
- try:
- image = pygame.image.load(next_image.next())
- except StopIteration:
- sys.exit()
-
- # Scale up from 640x480 -> 1280x960
- newImage = pygame.transform.rotozoom(image, 0, 2.0)
- newImageRect = newImage.get_rect()
- newImageRect.centerx = screen.get_rect().centerx
- newImageRect.centery = screen.get_rect().centery
-
- screen.fill(bgcolor)
- screen.blit(newImage, newImageRect)
- pygame.display.flip()
diff --git a/data/graphics/snow b/data/graphics/snow
index 4fc30f2..efcb28f 100644
--- a/data/graphics/snow
+++ b/data/graphics/snow
@@ -1,3 +1,4 @@
+# snow
import pippy, pygame, sys
from pygame.locals import *
@@ -6,17 +7,17 @@ from random import *
# always need to init first thing
pygame.init()
-# XO screen is 1200x900
-size = width, height = 1200, 900
-
# create the window and keep track of the surface
# for drawing into
-screen = pygame.display.set_mode(size)
+screen = pygame.display.set_mode()
+
+# ask for screen's width and height
+width, height = screen.get_size()
# turn off the cursor
pygame.mouse.set_visible(False)
-bg_color = (0,0,0)
+bg_color = (0, 0, 0)
xs = []
ys = []
diff --git a/data/graphics/tree b/data/graphics/tree
index f4cdae7..acbdf78 100644
--- a/data/graphics/tree
+++ b/data/graphics/tree
@@ -1,71 +1,72 @@
-
-import pippy, pygame, sys
-from pygame.locals import *
-from random import *
-import math
-
-# always need to init first thing
-pygame.init()
-
-# XO screen is 1200x900
-size = width, height = 1200, 900
-
-# create the window and keep track of the surface
-# for drawing into
-screen = pygame.display.set_mode(size)
-
-# turn off the cursor
-pygame.mouse.set_visible(False)
-
-color = (250,250,250)
-min_factor = 0.8
-max_factor = 0.9
-start_length = 130
-min_length = 40
-min_angle_delta = 0.4
-max_angle_delta = 0.5
-
-# start the screen all black
-bgcolor = (0,0,0)
-screen.fill(bgcolor)
-
-def draw_tree(x, y, length, angle):
- x2 = x + length * math.sin(angle)
- y2 = y - length * math.cos(angle)
- pygame.draw.line(screen, color, (x, y), (x2, y2))
-
- if length > min_length:
- # draw left branch
- left_angle = angle - \
- uniform(min_angle_delta, max_angle_delta)
- left_length = length * \
- uniform(min_factor, max_factor)
- draw_tree(x2, y2, left_length, left_angle)
- # draw middle branch
- middle_length = length * \
- uniform(min_factor, max_factor)
- draw_tree(x2, y2, middle_length, angle)
- # draw right branch
- right_angle = angle + \
- uniform(min_angle_delta, max_angle_delta)
- right_length = length * \
- uniform(min_factor, max_factor)
- draw_tree(x2, y2, right_length, right_angle)
-
-# clear the screen
-screen.fill(bgcolor)
-
-# draw a tree, starting at the bottom centre of the
-# screen
-draw_tree((width / 2), height - 20, start_length, 0)
-pygame.display.flip()
-
-while pippy.pygame.next_frame():
- # chill until a key is pressed
- for event in pygame.event.get():
- if event.type == QUIT:
- sys.exit()
-
- if event.type == KEYDOWN:
- if event.key == K_ESCAPE:
- sys.exit()
+# tree
+
+import pippy, pygame, sys
+from pygame.locals import *
+from random import *
+import math
+
+# always need to init first thing
+pygame.init()
+
+# create the window and keep track of the surface
+# for drawing into
+screen = pygame.display.set_mode()
+
+# ask for screen's width and height
+width, height = screen.get_size()
+
+# turn off the cursor
+pygame.mouse.set_visible(False)
+
+color = (250, 250, 250)
+min_factor = 0.8
+max_factor = 0.9
+start_length = 130
+min_length = 40
+min_angle_delta = 0.4
+max_angle_delta = 0.5
+
+# start the screen all black
+bgcolor = (0,0,0)
+screen.fill(bgcolor)
+
+def draw_tree(x, y, length, angle):
+ x2 = x + length * math.sin(angle)
+ y2 = y - length * math.cos(angle)
+ pygame.draw.line(screen, color, (x, y), (x2, y2))
+
+ if length > min_length:
+ # draw left branch
+ left_angle = angle - \
+ uniform(min_angle_delta, max_angle_delta)
+ left_length = length * \
+ uniform(min_factor, max_factor)
+ draw_tree(x2, y2, left_length, left_angle)
+ # draw middle branch
+ middle_length = length * \
+ uniform(min_factor, max_factor)
+ draw_tree(x2, y2, middle_length, angle)
+ # draw right branch
+ right_angle = angle + \
+ uniform(min_angle_delta, max_angle_delta)
+ right_length = length * \
+ uniform(min_factor, max_factor)
+ draw_tree(x2, y2, right_length, right_angle)
+
+# clear the screen
+screen.fill(bgcolor)
+
+# draw a tree, starting at the bottom centre of the
+# screen
+draw_tree((width / 2), height - 20, start_length, 0)
+pygame.display.flip()
+
+# do nothing visible until the escape key is pressed
+while pippy.pygame.next_frame():
+ for event in pygame.event.get():
+ if event.type == QUIT:
+ sys.exit()
+
+ if event.type == KEYDOWN:
+ if event.key == K_ESCAPE:
+ sys.exit()
diff --git a/data/graphics/xolympics b/data/graphics/xolympics
new file mode 100644
index 0000000..525e480
--- /dev/null
+++ b/data/graphics/xolympics
@@ -0,0 +1,150 @@
+#!/usr/bin/python
+"""
+XOlympics is a 2 player game where you are a triangle!
+Use w,a,s,d and up,down,left,right to play.
+Score by making the newest ball hit your opponent's wall.
+"""
+
+import pippy, pygame, sys, math
+from pygame.locals import *
+from pippy import physics
+from pygame.color import *
+
+from pippy.physics import box2d
+
+class XOlympicsGame:
+ def __init__(self):
+ self.rightscore = self.leftscore = 0
+ self.forcespeed = 75
+ self.jumpforce = 20
+ self.leftDPress = False
+ self.rightDPress = False
+ self.leftLPress = False
+ self.leftRPress = False
+ self.leftJump = False
+ self.rightLPress = False
+ self.rightRPress = False
+ self.rightJump = False
+ self.updateList = []
+
+ self.screen = pygame.display.set_mode()
+ self.width, self.height = self.screen.get_size()
+
+ self.clock = pygame.time.Clock()
+
+ # set up the world (instance of Elements)
+ self.world = physics.Elements(self.screen.get_size())
+ self.world.renderer.set_surface(self.screen)
+ # set up static environment
+ self.world.set_color((0, 255, 0))
+ self.world.add.ground()
+ self.ball = self.world.add.ball((self.width / 2, 0), 50)
+ # add the left border and player (red)
+ self.world.set_color((255, 0, 0))
+ self.world.add.rect((0, -20), 25, self.height,
+ dynamic=False, density=1.0,
+ restitution=0.16, friction=0.5)
+ self.leftplayer = self.world.add.poly(( self.width * 0.25, 81.0 ), [(-109.9405166666667, -64.244016666666653), (110.60718333333335, -63.089316666666605), (-0.66666666666668561, 127.33333333333337)] , dynamic=True, density=1.0, restitution=0.16, friction=0.5, screenCoord=False)
+ # add the right border and player (blue)
+ self.world.set_color((0, 0, 255))
+ self.world.add.rect((self.width, -20), 25, self.height,
+ dynamic=False, density=1.0,
+ restitution=0.16, friction=0.5)
+ self.rightplayer = self.world.add.poly(( self.width * 0.75, 81.0 ), [(108.94051666666667, -65.976066666666611), (2.6666666666666288, 127.33333333333337), (-111.60718333333341, -61.357266666666646)] , dynamic=True, density=1.0, restitution=0.16, friction=0.5, screenCoord=False)
+ # we're getting 2 grounds - grey and green. why?
+
+ def run(self):
+ self.running = True
+ while self.running:
+
+ for event in pygame.event.get():
+ if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
+ self.running = False
+ if (event.type == KEYDOWN and (event.key == K_a or event.key == K_KP4)):
+ self.leftLPress = True
+ if (event.type == KEYUP and (event.key == K_a or event.key == K_KP4)):
+ self.leftLPress = False
+ if (event.type == KEYDOWN and (event.key == K_s or event.key == K_KP2)):
+ self.leftDPress = True
+ if (event.type == KEYUP and (event.key == K_s or event.key == K_KP2)):
+ self.leftDPress = False
+ if (event.type == KEYDOWN and (event.key == K_d or event.key == K_KP6)):
+ self.leftRPress = True
+ if (event.type == KEYUP and (event.key == K_d or event.key == K_KP6)):
+ self.leftRPress = False
+ if (event.type == KEYDOWN and (event.key == K_w or event.key == K_KP8)):
+ self.leftJump = True
+ if (event.type == KEYUP and (event.key == K_w or event.key == K_KP8)):
+ self.leftJump = False
+ if (event.type == KEYDOWN and (event.key == K_LEFT or event.key == K_KP7)):
+ self.rightLPress = True
+ if (event.type == KEYUP and (event.key == K_LEFT or event.key == K_KP7)):
+ self.rightLPress = False
+ if (event.type == KEYDOWN and (event.key == K_RIGHT or event.key == K_KP1)):
+ self.rightRPress = True
+ if (event.type == KEYUP and (event.key == K_RIGHT or event.key == K_KP1)):
+ self.rightRPress = False
+ if (event.type == KEYDOWN and (event.key == K_UP or event.key == K_KP9)):
+ self.rightJump = True
+ if (event.type == KEYUP and (event.key == K_UP or event.key == K_KP9)):
+ self.rightJump = False
+ if (event.type == KEYDOWN and (event.key == K_DOWN or event.key == K_KP3)):
+ self.rightDPress = True
+ if (event.type == KEYUP and (event.key == K_DOWN or event.key == K_KP3)):
+ self.rightDPress = False
+
+ if self.leftLPress:
+ self.leftplayer.ApplyForce(box2d.b2Vec2(-self.forcespeed,0), self.leftplayer.GetWorldCenter())
+ if self.leftRPress:
+ self.leftplayer.ApplyForce(box2d.b2Vec2(self.forcespeed,0), self.leftplayer.GetWorldCenter())
+ if self.leftJump:
+ if self.leftplayer.GetWorldCenter().y < 0.75:
+ self.leftplayer.ApplyImpulse(box2d.b2Vec2(0,self.jumpforce), self.leftplayer.GetWorldCenter())
+ if self.rightLPress:
+ self.rightplayer.ApplyForce(box2d.b2Vec2(-self.forcespeed,0), self.rightplayer.GetWorldCenter())
+ if self.rightRPress:
+ self.rightplayer.ApplyForce(box2d.b2Vec2(self.forcespeed,0), self.rightplayer.GetWorldCenter())
+ if self.rightDPress:
+ self.rightplayer.ApplyImpulse(box2d.b2Vec2(0,-self.jumpforce), self.rightplayer.GetWorldCenter())
+ if self.rightJump:
+ if self.rightplayer.GetWorldCenter().y < 0.75:
+ self.rightplayer.ApplyImpulse(box2d.b2Vec2(0,self.jumpforce), self.rightplayer.GetWorldCenter())
+ if self.leftDPress:
+ self.leftplayer.ApplyImpulse(box2d.b2Vec2(0,-self.jumpforce), self.leftplayer.GetWorldCenter())
+
+ # Clear Display
+ if self.ball.GetWorldCenter().x < 1:
+ self.leftscore += 1
+ print "Goal Blue!", self.leftscore
+ self.world.set_color((0, 0, 255))
+ self.ball = self.world.add.ball((self.width/2, 0), 50)
+ elif self.ball.GetWorldCenter().x > 11:
+ # FIXME: the 11 above works only when display width is
+ # 1200 pixels
+ self.rightscore += 1
+ print "Goal Red!", self.rightscore
+ self.world.set_color((255, 0, 0))
+ self.ball = self.world.add.ball((self.width/2, 0), 50)
+
+ self.screen.fill((255,255,255))
+ # Update & Draw World
+ self.world.update()
+ self.world.draw()
+
+ # Flip Display
+ pygame.display.flip()
+
+ # Try to stay at 30 FPS
+ self.clock.tick(30) # originally 50
+
+def main():
+ pygame.init()
+ pygame.display.init()
+ # create an instance of the game
+ game = XOlympicsGame()
+ # start the main loop
+ game.run()
+
+# make sure that main is called
+if __name__ == '__main__':
+ main()
diff --git a/data/sound/playSine b/data/sound/playSine
index 159b84b..216b4aa 100644
--- a/data/sound/playSine
+++ b/data/sound/playSine
@@ -2,4 +2,4 @@ import pippy
pippy.sound.playSine(pitch=1000, amplitude=5000)
pippy.sound.audioOut()
-
+
diff --git a/data/sound/playWave b/data/sound/playWave
index 503b475..819ad4f 100644
--- a/data/sound/playWave
+++ b/data/sound/playWave
@@ -2,4 +2,4 @@ import pippy
pippy.sound.playWave(sound='didjeridu', loop=True, duration=5)
pippy.sound.audioOut()
-
+
diff --git a/data/string/thanks b/data/string/thanks
index 52e47a3..ddd470a 100644
--- a/data/string/thanks
+++ b/data/string/thanks
@@ -17,14 +17,14 @@ table = {
'Directors & Advisors': 'Howard Anderson, Rebecca Allen, Ayo Kusamotu, Jose Maria Aznar, V. Michael Bove, Jr., Rodrigo Mesquita, Seymour Papert, Ted Selker, Ethan Beard (Google); John Roese (Nortel); Dandy Hsu (Quanta); Marcelo Claure (Brightstar); Gary Dillabough (eBay); Gustavo Arenas (AMD); Mike Evans (Red Hat); Ed Horowitz (SES Astra); Jeremy Philips (NewsCorp); Scott Soong (Chi Lin); Sehat Sutardja (Marvell); Joe Jacobson (MIT Media Lab); Steve Kaufman (Riverside); and Tom Meredith (MFI)',
'Pippy': 'Chris Ball, C. Scott Ananian'
}
-
+
import random, time
from pippy.console import *
from textwrap import fill
-# Determine the number of columns in our window in
-# order to wrap text to that width -- this changes
-# when we run as a standalone activity instead of
+# Determine the number of columns in our window in
+# order to wrap text to that width -- this changes
+# when we run as a standalone activity instead of
# inside the output pane.
cols, lines = size()
@@ -36,5 +36,9 @@ while True:
random.choice([red, green, yellow, blue, magenta, cyan])()
#random.choice([normal, bold, underlined, inverse])()
print '\n', fill("%s: %s" % (subsystem, table[subsystem]), int(cols))
+ table.pop(subsystem)
+ if len(table) == 0:
+ break
time.sleep(3)
+reset()