예제 #1
0
    def run(self, ticks):
        if self.cmdPlay:
            self.startGame()
            return
        if len(self.engine.world.songQueue) > 0 and self.queued:
            self.startGame(fromQueue = True)
            return
        if self.gameStarted or self.items == []:
            return

        Scene.run(self, ticks)
        if self.queued:
            self.queued = False
        if self.scrolling:
            self.scrollTime -= ticks
            if self.scrollTime < 0:
                self.scrollTime = self.scrollRate
                self.scroller[self.scrolling]()

        if self.mode == 0:
            if self.previewDelay > 0 and self.autoPreview:
                self.previewDelay -= ticks
                if self.previewDelay < 0:
                    self.previewDelay = 0
            if not self.previewLoaded and self.previewDelay == 0:
                self.previewSong()

            d = self.cameraOffset - self.selectedOffset
            self.cameraOffset -= d * ticks / 192.0
            for i in range(len(self.itemRenderAngles)):
                if i == self.selectedIndex:
                    self.itemRenderAngles[i] = min(90, self.itemRenderAngles[i] + ticks / 2.0)
                else:
                    self.itemRenderAngles[i] = max(0,  self.itemRenderAngles[i] - ticks / 2.0)

            if self.moreInfo:
                self.moreInfoTime += ticks
            elif self.moreInfoTime > 0:
                self.moreInfoTime -= ticks
                if self.moreInfoTime < 0:
                    self.moreInfoTime = 0

        self.engine.theme.setlist.run(ticks)
예제 #2
0
 def test_run(self):
     scene = Scene(self.engine)
     ticks = 1
     scene.run(ticks)
     self.assertEqual(scene.time, ticks / 50.0)