if __name__ == "__main__": sysData = SysData() white = sysData.screenColor pygame.init() screen = PygScreen() screen.setSize( sysData.screenSizeX, sysData.screenSizeY) screen.setDisplay( ) ball = BallObj() ball.setSpeed( 0, -5 ) ball.setObj( sysData.ballBmp ) ball.setRect_pos( 50, 240 ) bar = BarObj() bar.setObj( sysData.barBmp) bar.setRect_pos( 150, 200 ) warp = WarpObj() warp.setObj( sysData.warpBmp ) warp.setRect_pos( 230, 150 ) mediator = Mediator() while True: time.sleep(sysData.waitTime) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit()
while True: #clock.tick(sysData.waitTime) print clock.tick_busy_loop(sysData.waitTime) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() # ボール生成部分 # TODO: ボール生成個数とボール射出タイミングはsysDataに移動 if len(balls) < 3: ballMakeTiming = ballMakeTiming + 1 if ballMakeTiming > 25: ball = BallObj() ball.setSpeed( 0, 0 ) ball.setObj( sysData.ballBmp ) ball.setRect_pos( 60,-100 ) balls.append( ball ) ballMakeTiming = 0 # ボールの次のフレームの動作 for ball in balls: ball.ballMove() ball.decideBallPosition(pygame.key.get_pressed(), screen.getSize() ) #print balls[0].getBallrect() # ボールとバーが衝突した際の動作 for ball in balls: mediator.judgeConflictBallAndBar( ball, barRight ) mediator.judgeConflictBallAndBar( ball, barLeft )
if __name__ == "__main__": sysData = SysData() white = sysData.screenColor pygame.init() screen = PygScreen() screen.setSize(sysData.screenSizeX, sysData.screenSizeY) screen.setDisplay() ball = BallObj() ball.setSpeed(0, -5) ball.setObj(sysData.ballBmp) ball.setRect_pos(50, 240) bar = BarObj() bar.setObj(sysData.barBmp) bar.setRect_pos(150, 200) warp = WarpObj() warp.setObj(sysData.warpBmp) warp.setRect_pos(230, 150) mediator = Mediator() while True: time.sleep(sysData.waitTime) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit()