コード例 #1
0
ファイル: testGraphics.py プロジェクト: walsh06/RebelEngine
class TestGame(RBGame):

    def __init__(self):
        super(TestGame, self).__init__()
        self.initGraphics(100, 100)
        self.testGraphics = self._graphics
        self.initController()
        self.testController = self._controller
        self.testController.registerKeyFunction("q", self.quit)
        self.testText = RBText("TEST", RB2DPosition(100, 150))
        self.testCircle = RBCircle(RB2DPosition(20, 20), 10, "red", "red")
        self.testRec = RBRectangle(RB2DPosition(50, 50), 10, 20)

        self._running = True

    def update(self):
        count = 0
        x = 20
        y = 20
        while self._running:
            super(TestGame, self).update()
            count += 1

            self.testText.draw(self.testGraphics)
            x += 1
            y += 1
            self.testCircle.draw(self.testGraphics, x, y)

            self.testRec.draw(self.testGraphics, x + 30, y + 30)

    def quit(self):
        self._running = False
コード例 #2
0
ファイル: testApp.py プロジェクト: walsh06/RebelEngine
class TestGame(RBGame):

    def __init__(self):
        super(TestGame, self).__init__()
        self.initGraphics(200, 200)
        self.testGraphics = self._graphics
        self.initController()
        self.testController = self._controller
        self.testController.registerKeyFunction("q", self.quit)
        self.testPlayer = TestPlayer(0, 0, "ship.png")
        self.testController.registerKeyFunction("Left", self.testPlayer.moveLeft)
        self.testController.registerKeyFunction("Right", self.testPlayer.moveRight)
        self.testImage = RBImage("ship.png", RB2DPosition(100, 100))
        self.testText = RBText("SHIP", RB2DPosition(100, 50))
        self._running = True

    def update(self):
        count = 0
        while self._running:
            super(TestGame, self).update()

            self.testPlayer.draw(self.testGraphics)

            count += 1

            if count == 30:
                self.testImage.undraw(self.testGraphics)
                self.testText.undraw(self.testGraphics)
            elif count < 30:
                self.testImage.draw(self.testGraphics, 100, 100)
                self.testText.draw(self.testGraphics)

    def quit(self):
        self._running = False
コード例 #3
0
ファイル: testSound.py プロジェクト: walsh06/RebelEngine
class TestGame(RBGame):

    def __init__(self):
        super(TestGame, self).__init__()
        self.testSound = RBSound("test.wav")
        self.initGraphics(100, 100)
        self.testGraphics = self._graphics
        self.initController()
        self.testController = self._controller
        self.testController.registerKeyFunction("q", self.quit)
        self.testController.registerKeyFunction("space", self.playSound)
        self.testText = RBText("TEST", RB2DPosition(100, 50))
        self._running = True

    def update(self):
        count = 0
        while self._running:
            super(TestGame, self).update()
            count += 1

            self.testText.draw(self.testGraphics)

    def playSound(self):
        tempSound = RBTempSound("test.wav")

    def quit(self):
        self._running = False
コード例 #4
0
ファイル: testSound.py プロジェクト: walsh06/RebelEngine
 def __init__(self):
     super(TestGame, self).__init__()
     self.testSound = RBSound("test.wav")
     self.initGraphics(100, 100)
     self.testGraphics = self._graphics
     self.initController()
     self.testController = self._controller
     self.testController.registerKeyFunction("q", self.quit)
     self.testController.registerKeyFunction("space", self.playSound)
     self.testText = RBText("TEST", RB2DPosition(100, 50))
     self._running = True
コード例 #5
0
ファイル: testGraphics.py プロジェクト: walsh06/RebelEngine
    def __init__(self):
        super(TestGame, self).__init__()
        self.initGraphics(100, 100)
        self.testGraphics = self._graphics
        self.initController()
        self.testController = self._controller
        self.testController.registerKeyFunction("q", self.quit)
        self.testText = RBText("TEST", RB2DPosition(100, 150))
        self.testCircle = RBCircle(RB2DPosition(20, 20), 10, "red", "red")
        self.testRec = RBRectangle(RB2DPosition(50, 50), 10, 20)

        self._running = True
コード例 #6
0
ファイル: testApp.py プロジェクト: walsh06/RebelEngine
 def __init__(self):
     super(TestGame, self).__init__()
     self.initGraphics(200, 200)
     self.testGraphics = self._graphics
     self.initController()
     self.testController = self._controller
     self.testController.registerKeyFunction("q", self.quit)
     self.testPlayer = TestPlayer(0, 0, "ship.png")
     self.testController.registerKeyFunction("Left", self.testPlayer.moveLeft)
     self.testController.registerKeyFunction("Right", self.testPlayer.moveRight)
     self.testImage = RBImage("ship.png", RB2DPosition(100, 100))
     self.testText = RBText("SHIP", RB2DPosition(100, 50))
     self._running = True