From 7036ea9ed03a44d3c315c3bb78c1d4b76c6d6c8a Mon Sep 17 00:00:00 2001 From: frank <420@shampoo.ooo> Date: Fri, 28 Jan 2022 12:14:08 -0500 Subject: [PATCH] variable for how long before the title screen unlock resets from no input --- NS.py | 10 ++++++++-- config | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NS.py b/NS.py index 53baf7d..99a823d 100644 --- a/NS.py +++ b/NS.py @@ -68,7 +68,7 @@ class NS(Game, Animation): "time": { "int": ["timer-max-time", "timer-start-time", "timer-addition", "sword-delay", - "attract-gif-length", "attract-board-length"] + "attract-gif-length", "attract-board-length", "attract-reset-countdown"] }, "input": { @@ -520,6 +520,9 @@ class Logo(Sprite): class Title(Animation): + """ + Handles displaying and drawing the title screen. + """ UNLOCK_MOVES = NS.NW, NS.N, NS.NE, NS.NW @@ -649,11 +652,14 @@ class Title(Animation): self.video.move(dy=dsr.top - self.video.location.top) dx, dy = get_delta(self.angle, 5, False) self.video.move(dx, dy) + # Hide GIFs/attract mode (or keep them hidden) if input is detected. Set a countdown that will turn + # attract mode back on if no input is detected before the countdown expires. As long as input keeps + # being detected, this block will keep running and restarting the countdown. if platform.get_pressed(): self.video.hide() self.get_game().tony.set_frameset("static") self.halt() - self.play(self.show_video, delay=10000, play_once=True) + self.play(self.show_video, delay=self.get_configuration("time", "attract-reset-countdown"), play_once=True) self.video.update() self.draw_scores() diff --git a/config b/config index 1b4b33d..7dd5013 100644 --- a/config +++ b/config @@ -43,6 +43,7 @@ timer-addition = 1000 sword-delay = 300 attract-gif-length = 10000 attract-board-length = 3600 +attract-reset-countdown = 30000 [bgm] title = resource/bgm/title.ogg, .65