Corona SDK预加载图像和物理实体 [英] Corona SDK preload images and physics bodies

查看:73
本文介绍了Corona SDK预加载图像和物理实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个游戏,该游戏会生成角色驾驶的随机风景.现在有7个部分",总共可能有25个左右.例如,一个部分是山丘,一个部分是坡道,等等.当角色经过上一个部分之间的一半时,我正在加载这些图像和物理物体(由Physics Editor制作).上一节也被破坏了.调用此函数时会发生帧速率跳跃,因为它会在游戏过程中加载这些图像和物理物体.在用户开始玩游戏之前,我将如何预加载这些图像和物理物体?谢谢!

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!

推荐答案

使用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 )

这篇关于Corona SDK预加载图像和物理实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆