from naja.constants import KEYS, FPS
from naja.scenes.scene import Scene
+from naja.utils import Flashlight
from naja.widgets.text import TextWidget, TextBoxWidget
from naja.widgets.image_box import ImageBox
from naja.events import SceneChangeEvent
def __init__(self, state):
super(CreditsScene, self).__init__(state)
- self.autoscroll = 0
+ self.flashlight = Flashlight(int(1.5 * FPS))
background = ImageBox(
(0, 0), "screens/splash.png")
self.add(self.credits)
def render_scene(self, surface):
- if self.autoscroll is not None:
- self.autoscroll += 1
- if self.autoscroll >= 1.5 * FPS:
- fake_event = pygame.event.Event(pgl.KEYDOWN, key=pgl.K_DOWN)
- self.credits.handle_event(fake_event)
- self.autoscroll = 0
+ if self.flashlight is not None:
+ if self.flashlight.tick():
+ fake_event = pygame.event.Event(pgl.KEYDOWN, key=pgl.K_DOWN)
+ self.credits.handle_event(fake_event)
def handle_event(self, ev):
if ev.type == pgl.KEYDOWN:
- self.autoscroll = None
+ self.flashlight = None
return super(CreditsScene, self).handle_event(ev)
def handle_scene_event(self, ev):