Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorRafael Ortiz <rafael@activitycentral.com>2011-04-25 22:04:33 (GMT)
committer Rafael Ortiz <rafael@activitycentral.com>2011-04-25 22:04:33 (GMT)
commitfe35640cf8053ec313007adf4bca218e97bb3ec5 (patch)
treed1b28ef3c794ddd1dcd0e212eecd8dd62f8fe455 /data
parent0af876941a1a49dd6bf1bf8d01a518268533c044 (diff)
pep8 fixes
Diffstat (limited to 'data')
-rw-r--r--data/graphics/pong10
-rw-r--r--data/graphics/tree1
-rw-r--r--data/graphics/xolympics10
3 files changed, 12 insertions, 9 deletions
diff --git a/data/graphics/pong b/data/graphics/pong
index 9134f53..bd2f75f 100644
--- a/data/graphics/pong
+++ b/data/graphics/pong
@@ -36,7 +36,7 @@ paddle_width = 20
paddle_length = 100
paddle_radius = paddle_length / 2
paddle_color = (250, 250, 250)
-step = 6 # paddle moves 3 pixels at a go
+step = 6 # paddle moves 3 pixels at a go
# ball constants
ball_color = (250, 250, 250)
@@ -68,7 +68,7 @@ while pippy.pygame.next_frame():
if idle_event.key == K_ESCAPE:
sys.exit()
- if idle_event.key == 103: # g key
+ if idle_event.key == 103: # g key
# play a game!
@@ -85,7 +85,7 @@ while pippy.pygame.next_frame():
ball_limit = size
balls = balls - 1
- while ball_position[0] + ball_radius < ball_limit[0]: # in play
+ while ball_position[0] + ball_radius < ball_limit[0]: # in play
for event in pygame.event.get():
if event.type == QUIT:
@@ -96,11 +96,11 @@ while pippy.pygame.next_frame():
sys.exit()
elif event.key == 273 \
or event.key == 265 \
- or event.key == 264: # up
+ or event.key == 264: # up
paddle_location = paddle_location - step
elif event.key == 274 \
or event.key == 259 \
- or event.key == 258: # down
+ or event.key == 258: # down
paddle_location = paddle_location + step
# make sure the paddle is in-bounds
diff --git a/data/graphics/tree b/data/graphics/tree
index 5a56620..adc179f 100644
--- a/data/graphics/tree
+++ b/data/graphics/tree
@@ -32,6 +32,7 @@ max_angle_delta = 0.5
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)
diff --git a/data/graphics/xolympics b/data/graphics/xolympics
index 51be828..78f485a 100644
--- a/data/graphics/xolympics
+++ b/data/graphics/xolympics
@@ -15,6 +15,7 @@ from pygame.color import *
from pippy.physics import box2d
+
class XOlympicsGame:
def __init__(self):
self.rightscore = self.leftscore = 0
@@ -47,13 +48,13 @@ class XOlympicsGame:
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)
+ 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)
+ 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):
@@ -108,7 +109,7 @@ class XOlympicsGame:
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())
+ 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())
@@ -138,7 +139,8 @@ class XOlympicsGame:
pygame.display.flip()
# Try to stay at 30 FPS
- self.clock.tick(30) # originally 50
+ self.clock.tick(30) # originally 50
+
def main():
pygame.init()