Pausable tweens
This commit is contained in:
@@ -34,18 +34,14 @@
|
|||||||
(doFor sound currentSounds
|
(doFor sound currentSounds
|
||||||
(sound.pause))
|
(sound.pause))
|
||||||
(when music
|
(when music
|
||||||
(music.pause))
|
(music.pause)))
|
||||||
// TODO tweens
|
|
||||||
)
|
|
||||||
|
|
||||||
(method :Void resume []
|
(method :Void resume []
|
||||||
(FlxG.inputs.add actionManager)
|
(FlxG.inputs.add actionManager)
|
||||||
(doFor sound currentSounds
|
(doFor sound currentSounds
|
||||||
(sound.resume))
|
(sound.resume))
|
||||||
(when music
|
(when music
|
||||||
(music.resume))
|
(music.resume)))
|
||||||
// TODO tweens
|
|
||||||
)
|
|
||||||
|
|
||||||
(method :Void showPauseMenu [:Continuation resume]
|
(method :Void showPauseMenu [:Continuation resume]
|
||||||
// register escape to resume (and register escape to pause when resuming lol)
|
// register escape to resume (and register escape to pause when resuming lol)
|
||||||
@@ -440,8 +436,7 @@
|
|||||||
(method :Void hideBlackScreen []
|
(method :Void hideBlackScreen []
|
||||||
(FlxG.state.remove blackBG))
|
(FlxG.state.remove blackBG))
|
||||||
|
|
||||||
// TODO maybe credits need their own substate so an after-credits scene could be done.
|
// TODO currently the bg will cover whatever the final scene was - making after credits scenes impossible
|
||||||
// currently the bg will cover whatever the final scene was.
|
|
||||||
(method :Void rollCredits [:Array<CreditsLine> credits cc]
|
(method :Void rollCredits [:Array<CreditsLine> credits cc]
|
||||||
(localVar bg (new FlxSprite))
|
(localVar bg (new FlxSprite))
|
||||||
(bg.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
(bg.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
||||||
@@ -489,4 +484,10 @@
|
|||||||
(doFor text creditsText
|
(doFor text creditsText
|
||||||
(FlxG.state.add text)
|
(FlxG.state.add text)
|
||||||
(set text.cameras [flxMovie.uiCamera])
|
(set text.cameras [flxMovie.uiCamera])
|
||||||
(FlxTween.linearMotion text text.x text.y text.x (- text.y textY) 200 false (object onComplete ->:Void _ (cc)))))
|
(let [:Array<Dynamic> 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))))
|
@@ -11,6 +11,7 @@ import hollywoo_flixel.ActorFlxSprite;
|
|||||||
import kiss_flixel.SpriteTools;
|
import kiss_flixel.SpriteTools;
|
||||||
import kiss_tools.FlxKeyShortcutHandler;
|
import kiss_tools.FlxKeyShortcutHandler;
|
||||||
import openfl.Assets;
|
import openfl.Assets;
|
||||||
|
import flixel.tweens.FlxTween;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model/controller of a Hollywoo-Flixel film, and main execution script
|
* Model/controller of a Hollywoo-Flixel film, and main execution script
|
||||||
@@ -29,6 +30,8 @@ class FlxMovie extends Movie<FlxSprite, ActorFlxSprite, FlxSound, String, FlxSpr
|
|||||||
public var uiCamera:FlxCamera;
|
public var uiCamera:FlxCamera;
|
||||||
public var screenCamera:FlxCamera;
|
public var screenCamera:FlxCamera;
|
||||||
|
|
||||||
|
public var tweens:Array<FlxTween> = [];
|
||||||
|
|
||||||
public var STAGE_LEFT_X:Float;
|
public var STAGE_LEFT_X:Float;
|
||||||
public var STAGE_RIGHT_X:Float;
|
public var STAGE_RIGHT_X:Float;
|
||||||
public var ACTOR_WIDTH:Int;
|
public var ACTOR_WIDTH:Int;
|
||||||
|
@@ -4,6 +4,25 @@
|
|||||||
(loadFrom "hollywoo" "src/hollywoo/Movie.kiss")
|
(loadFrom "hollywoo" "src/hollywoo/Movie.kiss")
|
||||||
(loadFrom "hollywoo-flixel" "src/hollywoo_flixel/Aliases.kiss")
|
(loadFrom "hollywoo-flixel" "src/hollywoo_flixel/Aliases.kiss")
|
||||||
|
|
||||||
|
(method :Dynamic callPrivate [:Dynamic obj :String method &rest :Array<Dynamic> args]
|
||||||
|
(Reflect.callMethod obj (Reflect.field obj method) args))
|
||||||
|
|
||||||
|
(method tween [:FlxTween tween]
|
||||||
|
(callPrivate FlxTween.globalManager "remove" tween false)
|
||||||
|
(tweens.push tween))
|
||||||
|
(method :TweenOptions tweenOpts [&opt :Void->Void cc]
|
||||||
|
(object
|
||||||
|
onComplete
|
||||||
|
->:Void tween {
|
||||||
|
(tweens.remove tween)
|
||||||
|
(when cc (cc))
|
||||||
|
}))
|
||||||
|
|
||||||
|
(method linearMotion [:FlxSprite sprite :Float destX :Float destY :Float speed &opt :Void->Void cc]
|
||||||
|
(tween
|
||||||
|
(FlxTween.linearMotion sprite sprite.x sprite.y destX destY speed false (tweenOpts cc))))
|
||||||
|
(defAlias &ident FlxTween.linearMotion CHANGE_TO_MOVIE_LINEARMOTION)
|
||||||
|
|
||||||
(method newFlxSet [name assetPath]
|
(method newFlxSet [name assetPath]
|
||||||
(let [setSprite (new FlxSprite 0 0)]
|
(let [setSprite (new FlxSprite 0 0)]
|
||||||
(setSprite.loadGraphic assetPath false 0 0 true) // Load uniquely so we can draw on sets for specific scenes
|
(setSprite.loadGraphic assetPath false 0 0 true) // Load uniquely so we can draw on sets for specific scenes
|
||||||
@@ -39,6 +58,9 @@
|
|||||||
`(new FlxSprite 0 0 ,(b.field (symbolNameValue asset) (b.symbol "AssetPaths"))))
|
`(new FlxSprite 0 0 ,(b.field (symbolNameValue asset) (b.symbol "AssetPaths"))))
|
||||||
|
|
||||||
(method :Void update [:Float elapsed]
|
(method :Void update [:Float elapsed]
|
||||||
|
(unless paused
|
||||||
|
(doFor tween tweens
|
||||||
|
(callPrivate tween "update" elapsed )))
|
||||||
(.update (cast (director.shortcutHandler) kiss_tools.FlxKeyShortcutHandler<Dynamic>)))
|
(.update (cast (director.shortcutHandler) kiss_tools.FlxKeyShortcutHandler<Dynamic>)))
|
||||||
|
|
||||||
(defAlias &ident flxDirector (cast director FlxDirector))
|
(defAlias &ident flxDirector (cast director FlxDirector))
|
||||||
|
Reference in New Issue
Block a user