Fix sceneKey preload-/run-time error
This commit is contained in:
@@ -8,25 +8,33 @@ AWAITPLAYSOUND "pageFlip"
|
|||||||
{(set soundPlayed true) (cc)}
|
{(set soundPlayed true) (cc)}
|
||||||
|
|
||||||
// Through scene transitions, set background sprites need to maintain the same size.
|
// Through scene transitions, set background sprites need to maintain the same size.
|
||||||
(defMacro makeSetAndScene [asset]
|
(defMacro makeSetAndScene [scene asset]
|
||||||
`(preload
|
`(preload
|
||||||
(newFlxSet ,asset ,asset)
|
(newFlxSet ,asset ,asset)
|
||||||
(newSceneFromSet ,asset ,asset Day Exterior (new FlxCamera))))
|
(newSceneFromSet ,scene ,asset Day Exterior (new FlxCamera))))
|
||||||
|
|
||||||
(var basicSceneKey AssetPaths.grayBackground1280x720__png)
|
(prop &mut basicSceneKey "")
|
||||||
(makeSetAndScene basicSceneKey)
|
(preload (set basicSceneKey (assetPath "assets" "grayBackground1280x720.png")))
|
||||||
|
(makeSetAndScene basicSceneKey basicSceneKey)
|
||||||
(prop &mut sk "")
|
(prop &mut sk "")
|
||||||
(prop &mut firstWidth 0.0)
|
(prop &mut firstWidth 0.0)
|
||||||
(prop &mut firstHeight 0.0)
|
(prop &mut firstHeight 0.0)
|
||||||
(defMacro testSetBackground [asset]
|
(defMacro testSetBackground [asset]
|
||||||
`(commands
|
`(commands
|
||||||
(makeSetAndScene ,asset)
|
// These happen at preload time
|
||||||
|
(makeSetAndScene ,asset ,asset)
|
||||||
|
(makeSetAndScene (+ "other" ,asset) ,asset)
|
||||||
|
// These happen at runtime:
|
||||||
{(set sk ,asset) (cc)}
|
{(set sk ,asset) (cc)}
|
||||||
SETSCENE sk
|
SETSCENE sk
|
||||||
(withSceneSet sk set
|
(withSceneSet sk set
|
||||||
(assert (or (= FlxG.width set.width) (= FlxG.height set.height)))
|
(assert (or (= FlxG.width set.width) (= FlxG.height set.height)))
|
||||||
(set firstWidth set.width)
|
(set firstWidth set.width)
|
||||||
(set firstHeight set.height))
|
(set firstHeight set.height))
|
||||||
|
SETSCENE "other$sk"
|
||||||
|
SETSCENE sk
|
||||||
|
(withSceneSet sk set
|
||||||
|
(assert (and (= firstWidth set.width) (= firstHeight set.height))))
|
||||||
SETSCENE basicSceneKey
|
SETSCENE basicSceneKey
|
||||||
SETSCENE sk
|
SETSCENE sk
|
||||||
(withSceneSet sk set
|
(withSceneSet sk set
|
||||||
|
|||||||
Reference in New Issue
Block a user