Jump to content

Animations get faster switching scenes


Recommended Posts

I have an old school RPG I am making and I have two main scenes, the Overworld and Encounter scenens.  The overworld is fine when switching to it but the problem is the Encounter, before I switch to it, I reset it so I can recreate it from scratch with a random monster in it.  The problem is, every time I switch/restart the Encounter scene, the animation of the creature gets progressively faster.

I do remove the animation key so I dont get the warning when I switch back to the Overworld scene.  Just curious if I am taking the right approach to this and if so, do I need to clean up the sprite of the monster before hand so it doesn't make the animation speed up?

Link to post
Share on other sites
15 hours ago, blade2xs said:

The problem is, every time I switch/restart the Encounter scene, the animation of the creature gets progressively faster.

I had this problem too, momentarily. I think it's related to the scene switching, not the animation itself.

Link to post
Share on other sites

Thanks guys,

This partially worked.  I ran a series of tests and, apparently, when the the scene preload and create methods get re-run, it is the culprit with increasing the animation speeds.

I say partially worked with the resume because I am stuck with the first creature I randomly created for the initial scene call...  I am working on a way to run a method in the scene to reinitialize the animations for the new creature.

Link to post
Share on other sites

Ok I solved it in a kind of hacky way... not super please but it works... I'll note it in a TODO in my code when I post it to github.  Basically I follow the advice here and had to set up all monster animations possible for the scene, then just before restarting the Encounter scene, I have to manually call a function to change the sprite animation and had to save the context of the encounter scene globally otherwise all the "this" references break... I'm not super happy with it but I have a deadline to meet and it works.

A nice to have would be some documentation on the best practice for switching between scenes like this.

Link to post
Share on other sites
  • 3 years later...

Hi, 

I found that this is happening when a scene is sleep and is started again. To avoid this, I use scene.stop() and scene. start() or scene.restart() to switch between scenes. Each time the scene is started, it will run faster, until crahses.

In my case, when I was clicking the menu button in the game scene, I was calling sleep() instead of stop(). So when I was starting the game scene, it was running faster an faster.

Just in case this helps.

Regards.

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.

×
×
  • Create New...