It looks like you're new here. If you want to get involved, click one of these buttons!
--define scenes sceneManager = SceneManager.new({ ["Menu"] = menu, ["Credits"] = credits, ["Help"] = help, ["Level 1"] = level1 }) application:setBackgroundColor(0x000000) --add manager to stage stage:addChild(sceneManager); sceneManager:changeScene("Level 1", 1); |
level1 = Core.class(Sprite) function level1:init() local loading = Bitmap.new(Texture.new("gfx/loading.png")) self:addChild(loading) local function preloader() -- load all your assets here local Atlas2 = TexturePack.new("Atlases/Atlas 2.txt", "Atlases/Atlas 2.png"); self:removeChild(loading) loading = nil; self:removeEventListener(Event.ENTER_FRAME, preloader) -- rest of code here end end |
Likes: ktc, SimplesApps, crimsongranny
Comments
Thanks for the reply!
I think your example only works when you're loading all the assets at the start.
I'm trying to load assets in different scenes and show a loading screen without interruptions to fade in/out.
Is there any way to do this?
Thank again guys!
https://deluxepixel.com
I think that a user defined 'level to level' pre-loader (with progress bar) would be brilliant.
Is this sort of feature on the roadmap?
Likes: GiderosFan
https://deluxepixel.com
Likes: SinisterSoft
When my 'game' is starting on a 2013 device, there's a black screen for a number of seconds before entering the main scene (not main.lua). What's happening during that black screen? I think it is loading all assets at that point (there's a great many textures and sound files) (but I'm not sure).
I'm thinking especially of this point in the code snippets above:
-- Load all your assets here
I've tried the enter frame event solution in both main.lua and init.lua, but it seems to do nothing, when the system runs through that code the assets seem to have been already loaded. Or am I getting it wrong?
Have a read of http://docs.giderosmobile.com/reference/gideros/Core/asyncCall and checkout the AsyncTextureLoading example in the latest build.
Likes: hgy29, simwhi, totebo, SinisterSoft, saeys
Likes: saeys, plicatibu
https://deluxepixel.com
Likes: antix, saeys
https://deluxepixel.com
Likes: antix