Пример #1
0
    def isCorrectSpeedChange( self, position, speed_before, key, speed_after ):
        # init object.
        pygame.init()
        screen = PygScreen()
        screen.setSize(100,100)
        ball = BallObj()
        ball.setObj( self.sysData.ballBmp )
        ball.setRect()

        # 判定処理
        ball.setBallrectLeft( position[0] )
        ball.setBallrectBottom( position[1] )
        ball.setSpeed( speed_before[0], speed_before[1] )
        pressed_keys_cp = \
            self.makeListFromKeyTuple( pygame.key.get_pressed() )
        if key != None:
            pressed_keys_cp[key] = 1

        ball.decideBallPosition( pressed_keys_cp, screen.getSize() )
        return speed_after == ball.getSpeed()
Пример #2
0
    def isCorrectSpeedChange(self, position, speed_before, key, speed_after):
        # init object.
        pygame.init()
        screen = PygScreen()
        screen.setSize(100, 100)
        ball = BallObj()
        ball.setObj(self.sysData.ballBmp)
        ball.setRect()

        # 判定処理
        ball.setBallrectLeft(position[0])
        ball.setBallrectBottom(position[1])
        ball.setSpeed(speed_before[0], speed_before[1])
        pressed_keys_cp = \
            self.makeListFromKeyTuple( pygame.key.get_pressed() )
        if key != None:
            pressed_keys_cp[key] = 1

        ball.decideBallPosition(pressed_keys_cp, screen.getSize())
        return speed_after == ball.getSpeed()
Пример #3
0
        # ボール生成部分
        # 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 )

        # ボールの射出間隔調整
        biggest = choiceBiggestShootTiming(balls)
        if biggest != None:
            biggest.shootTimingIncliment()

        # キーが押されたときバーを移動
        barLeft.moveAs2Key( pygame.key.get_pressed())