thiezar

Is there a way to keep some objects beetween states?

Recommended Posts

I have a game with a MainMenu state and a Play state.

I want to keep my animated background without reloading it (the animation should loop without interruptions) when I change from MainMenu state to Play state.

How can I do this?

Share this post


Link to post
Share on other sites

When you switch states, set the parameter that clears the world to FALSE, so the display list isn't changed at all. And then you'll have to clear away the things you don't need yourself, keeping the background going. Also the background object will either need creating outside of your state, or passed over as the state changes, so the reference isn't lost.

Share this post


Link to post
Share on other sites

When you switch states, set the parameter that clears the world to FALSE, so the display list isn't changed at all. And then you'll have to clear away the things you don't need yourself, keeping the background going. Also the background object will either need creating outside of your state, or passed over as the state changes, so the reference isn't lost.

 

Hi Rich, so what is the point of having the second parameter to FALSE if you have to manually pass over the objects to the next state so that those objects can be re-added. I mean.. you are actually re adding the objects again in the second state, then what is the second parameter set to FALSE doing anyway ? I am changing it to True and False, and I see it keeps cleaning the screen... there is no difference.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.