问题
I am creating a game that generates random landscapes that the character drives along. There are 7 "sections" right now, and there will probably be 25 or so total. For example, one section is a hill, one is a ramp, etc. I am loading these images and physics bodies (whch are made with Physics Editor) when the character passes halfway between the previous section. The previous section is also destroyed. There is a frame rate skip when this function is called because it is loading these images and physics bodies during the gameplay. How would I preload these images and physics bodies before the the user starts playing? Thanks!
回答1:
Use storyboard.loadScene
:
-- load scene module and call its createsScene, but do not display it:
storyboard.loadScene( "nextScene1", false, {...})
...do stuff...
-- Later, transition to the (already loaded) scene
storyboard.gotoScene( "scene2", "slideLeft", 800 )
来源:https://stackoverflow.com/questions/22674505/corona-sdk-preload-images-and-physics-bodies