Jump to content

new state


valentinaCom
 Share

Recommended Posts

hi :)

 

When starting a new state, All spites, images, etc' loaded in prev state are removed from stage? 

 

I have a 'game' state , in which I load some sprites, and then when I press a btn I start a new state. Until here it's all fine.

 

the problem is when I start 'game' state again. All loaded stuff from before are still there.. 

 

in the prload of 'game', I load a pack according to level in game. then I press a btn that takes me to a level screen in game (another state). There I can choose any level to play. When I for example start a new level (so I call 'game' state again) I still see the sprites laoded in level 1.

 

help?  :blink:

 

 

Link to comment
Share on other sites

This is something that requires you to destroy all the game elements and upon restarting that state again you create the game again. There are a few ways to achieve this with proper destruction and creation.

Some elements may not need destroyed at all depending on what your game is and does etc but you do need to destroy then recreate on loading the state again.

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...