From 6a604fed7f57393561fa5f3fa1ccc79c766fbc0a Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 3 Jul 2023 07:11:50 -0600 Subject: [PATCH] themedRollCredits support --- src/hollywoo_flixel/FlxDirector.kiss | 32 +++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/hollywoo_flixel/FlxDirector.kiss b/src/hollywoo_flixel/FlxDirector.kiss index 907c74a..77abb6a 100644 --- a/src/hollywoo_flixel/FlxDirector.kiss +++ b/src/hollywoo_flixel/FlxDirector.kiss @@ -727,13 +727,25 @@ (+= textY threeColSize creditMargin)) (otherwise))) - (doFor text creditsText - (FlxG.state.add text) - (set text.cameras [flxMovie.uiCamera]) - (let [:Array tweenArgs []] - (tweenArgs.push text) - (tweenArgs.push text.x) - (tweenArgs.push (- text.y textY)) - (tweenArgs.push 200) - (tweenArgs.push cc) - (Reflect.callMethod flxMovie (Reflect.field flxMovie "linearMotion") tweenArgs)))) \ No newline at end of file + (let [pixelsToScroll + (+ textY .height (last creditsText)) + idealTimeLimit + (/ pixelsToScroll IDEAL_SCROLL_SPEED) + timeLimitDifference (- idealTimeLimit timeLimit) + scrollSpeed + (if timeLimit + (/ pixelsToScroll timeLimit) + IDEAL_SCROLL_SPEED)] + (#when debug + (when !(= scrollSpeed IDEAL_SCROLL_SPEED) + (print "Time given for credit roll (${timeLimit}s) is $(Math.abs timeLimitDifference)sec $(if (> timeLimitDifference 0) "too short" "too long") for ideal speed."))) + (doFor text creditsText + (FlxG.state.add text) + (set text.cameras [flxMovie.uiCamera]) + (let [:Array tweenArgs []] + (tweenArgs.push text) + (tweenArgs.push text.x) + (tweenArgs.push (- text.y textY)) + (tweenArgs.push scrollSpeed) + (tweenArgs.push cc) + (Reflect.callMethod flxMovie (Reflect.field flxMovie "linearMotion") tweenArgs))))) \ No newline at end of file