Implementing a "Staged Loader"

Greetings all!

I’ve got a bit of an aesthetics question that I’m hoping someone can help me with.

In the project I’m working on, we now have enough art assets to require load times upwards of twenty seconds. To alleviate boredom, I’m trying to do something like what I’ve seen many games do: I’m trying to create a sequence of logo pictures that fade in and out as the game is loading. I don’t expect to be able to fade the cards in and out simultaneously with loading (threads be tricky, yo), but I’d like to be able to essentially show the cards, and load a chunk of the game between fade-out fade-in cycles.

In my case, I have three splash screens: “Company name presents” (screen A), “Game Title” (screen B), and “Loading…” screen C). What I’ve done is hand-divided my game loading logic into three functions, afterA, afterB, and afterC. I’d like the sequence of events at the s tart of the game to look like this:

Black screen
fade in A
run afterA function (takes about five seconds)
fade out A
fade in B
run afterB function (takes about seven seconds)
fade out B
fade in C
run afterC function (takes about five seconds)
switch to game-start screen

I attempted to implement this behavior using (a) a single animation, (b) a set of animations that call each other, and © a task that gets “tapped” by the end of the after* functions and triggers the fade-out, fade-in, load animation for the next stage. In all three implementation strategies, I don’t get the fade-in, fade-out effects; the engine fades in A, grinds through the loaders for seventeen seconds, and jumps straight to the game-start screen (or in some variations, fades out A and jumps to the game-start screen).

I suspect the problem is that Panda’s clock is wonderfully aggressive about keeping things time-synchronized, so that by the time an after* function wraps up, the timer knows it needs to blow right through the fade out, fade in animation steps and get right to work on the next after* function. Does anyone know the proper procedure to give Panda some “amnesia” so that it stops counting time when the after* functions are running and starts counting again when the animations need to play? I’m really new to understanding the clock engine; any help would be greatly appreciated!

Take care,

I know that I am tirering with this, but FSMs are (again) a good choice to do the things. they are complex, but I guess you can give each loading stage a own FSM-state and the FSM will handle:
o fading out (old card if existent)
o fading in (new card)
o keep card till the FSM gets the command to proceed to the next step

However, I think (I am not sure. Sorry) that there is a progress bar example somewhere what would help you here too. Just exchange the showing of the percentage with the Images you want to show whenever a certain level is reached.

Sorry, its late here. If you didn’t understood some of my text. lemme know :slight_smile:

Regards, Bigfoot29

The thing you have to do is make sure that the igloop task gets a chance to run between loading tasks. It’s this task that is responsible for updating the contents of your window.

One way to ensure that this task runs is to ensure that all your tasks get a chance to run. This means, for instance, returning completely from your task when it is finished, instead of immediately calling some other function. You can use a doLater() call to ensure that your next function gets called in the future.

Or, you can simply call base.graphicsEngine.renderFrame() yourself, whenever you want the screen to be updated. I think this is the way the progress bar example does it.