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() ball.ballMove( ) ball.decideBallPosition(pygame.key.get_pressed(), screen.getSize() ) # ボールとバーが衝突した際の動作 mediator.judgeConflictBallAndBar( ball, bar ) mediator.judgeConflictBallAndWarp( ball, warp, 50 ) screen.displayFill( white ) screen.displayBlit( ball.getObj(), ball.getBallrect() ) screen.displayBlit( bar.getObj(), bar.getRect() ) screen.displayBlit( warp.getObj(), warp.getRect() ) pygame.display.flip()
# ボールの次のフレームの動作 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 ) # ボールの射出間隔調整 biggest = choiceBiggestShootTiming(balls) if biggest != None: biggest.shootTimingIncliment() # キーが押されたときバーを移動 barLeft.moveAs2Key( pygame.key.get_pressed()) # 表示 screen.displayFill( white ) for ball in balls: screen.displayBlit( ball.getObj(), ball.getBallrect() ) screen.displayBlit( barRight.getObj(), barRight.getRect() ) screen.displayBlit( barLeft.getObj(), barLeft.getRect() ) pygame.display.flip()
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() ball.ballMove() ball.decideBallPosition(pygame.key.get_pressed(), screen.getSize()) # ボールとバーが衝突した際の動作 mediator.judgeConflictBallAndBar(ball, bar) mediator.judgeConflictBallAndWarp(ball, warp, 50) screen.displayFill(white) screen.displayBlit(ball.getObj(), ball.getBallrect()) screen.displayBlit(bar.getObj(), bar.getRect()) screen.displayBlit(warp.getObj(), warp.getRect()) pygame.display.flip()