fast-forward tweens x3
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
(prop :FlxActionDigital continueAction)
|
||||
(prop :FlxActionDigital fastForwardAction)
|
||||
(prop actionManager (new FlxActionManager))
|
||||
(prop &mut :Movie<FlxSprite,ActorFlxSprite,FlxSound,String,FlxSprite,FlxSound,FlxCamera,FlxLightSource> movie)
|
||||
(defAlias &ident flxMovie (cast movie FlxMovie))
|
||||
@@ -13,6 +14,13 @@
|
||||
(continueAction.addKey SPACE JUST_PRESSED)
|
||||
(continueAction.addMouse LEFT JUST_PRESSED)
|
||||
(actionManager.addAction continueAction)
|
||||
|
||||
(set fastForwardAction (new FlxActionDigital "Fast Forward"))
|
||||
// TODO allow configuring fast forward keys -- any key, specifically mapped keys, etc.
|
||||
(fastForwardAction.addKey SPACE PRESSED)
|
||||
(fastForwardAction.addMouse LEFT PRESSED)
|
||||
(actionManager.addAction fastForwardAction)
|
||||
|
||||
(FlxG.inputs.add actionManager)
|
||||
(set actionManager.resetOnStateSwitch NONE)
|
||||
|
||||
|
@@ -116,19 +116,22 @@
|
||||
(function flxSprite [:String asset]
|
||||
(new FlxSprite 0 0 asset))
|
||||
|
||||
(var FAST_FORWARD_MOD 3)
|
||||
|
||||
(defAlias &ident flxDirector (cast director FlxDirector))
|
||||
|
||||
(method :Void update [:Float elapsed]
|
||||
(doFor action nextFrameActions
|
||||
(action))
|
||||
(set nextFrameActions [])
|
||||
(unless paused
|
||||
(doFor tween tweens
|
||||
(callPrivate tween "update" elapsed)
|
||||
(when tween.finished
|
||||
(callPrivate tween "finish"))))
|
||||
(let [tweenElapsed (* elapsed (if flxDirector.fastForwardAction.triggered FAST_FORWARD_MOD 1))]
|
||||
(doFor tween tweens
|
||||
(callPrivate tween "update" tweenElapsed)
|
||||
(when tween.finished
|
||||
(callPrivate tween "finish")))))
|
||||
(.update (cast (director.shortcutHandler) kiss_tools.FlxKeyShortcutHandler<Dynamic>)))
|
||||
|
||||
(defAlias &ident flxDirector (cast director FlxDirector))
|
||||
|
||||
(prop &mut :FlxSprite _canvas null)
|
||||
(method :FlxSprite canvas []
|
||||
(unless (= _canvas?.width FlxG.width)
|
||||
|
Reference in New Issue
Block a user