...
 
Commits (2)
......@@ -44,10 +44,10 @@ class PongConfig:
# harder game parameters
playerLifes = 3
baseVelocity = 0.25
reboundSpeedUp = 1.04
startZoneSize = 0.3
minZoneSize = 0.1
reboundZoneShrink = 0.007
baseVelocity = 0.23
reboundSpeedUp = 1.03
startZoneSize = 0.45
minZoneSize = 0.11
reboundZoneShrink = 0.018
......@@ -286,7 +286,7 @@ def main():
def gameLoop(foo):
pg.gameLoop()
pyglet.clock.schedule_interval(gameLoop, 1/60.)
pyglet.clock.schedule_interval(gameLoop, 1/25.)
pyglet.app.run()
#TODO catch exceptions and stop barcode reader threads
......
......@@ -62,7 +62,7 @@ class BallView():
int(self.model.radius * 2 * self.ratio),
int(self.model.radius * 2 * self.ratio)
)
self.image = pyglet.image.load('../img/ball.png')
self.image = pyglet.image.load('../img/ball_272.png')
#self.ball = BallView(ball, self.ratio, self.ball_image)
self.sprite = pyglet.sprite.Sprite(img=self.image)
self.sprite.scale = (self.size[0] / float(self.sprite.width))
......@@ -76,13 +76,25 @@ class BallView():
self.sprite.draw()
class Jumbo():
def __init__(self):
self.image = pyglet.image.load('../img/intro.png')
self.sprite = pyglet.sprite.Sprite(img=self.image)
self.sprite.x = 0
self.sprite.y = 0
def draw(self):
self.sprite.draw()
class PlayerCode1():
def __init__(self, (ratio, height)):
self.ratio = ratio
self.height = height
self.ready = False
self.image = pyglet.image.load('../img/101.png')
self.image = pyglet.image.load('../img/101_272.png')
self.size = (
int(self.ratio / 7),
int(self.ratio / 7)
......@@ -108,7 +120,7 @@ class PlayerCode2():
self.ratio = ratio
self.height = height
self.ready = False
self.image = pyglet.image.load('../img/102.png')
self.image = pyglet.image.load('../img/102_272.png')
self.size = (
int(self.ratio / 7),
int(self.ratio / 7)
......@@ -136,7 +148,7 @@ class Heart():
self.height = height
self.image = pyglet.image.load('../img/heart.png')
self.sprite = pyglet.sprite.Sprite(img=self.image)
self.sprite.y = 10
self.sprite.y = self.height - self.image.height - 10
if side == 'right':
self.sprite.x = self.ratio - 40*i
elif side == 'left':
......@@ -167,6 +179,7 @@ class PygletCanvas(pyglet.window.Window):
self.rightZone = RightZone(gamefield, self.size)
self.leftPlayerHearts = [Heart(self.size, 'left', i) for i in range(1, 4)]
self.rightPlayerHearts = [Heart(self.size, 'right', i) for i in range(1, 4)]
self.jumbo = Jumbo()
def showGame(self):
self.stage = 'game'
......@@ -178,8 +191,9 @@ class PygletCanvas(pyglet.window.Window):
pyglet.gl.glClearColor(1.0, 1.0, 1.0, 0.0)
self.clear()
if self.stage == 'menu':
self.code1.draw()
self.code2.draw()
#self.code1.draw()
#self.code2.draw()
self.jumbo.draw()
elif self.stage == 'game':
self.leftZone.draw()
self.rightZone.draw()
......