Game speed increases itself on every restart

Hi all, am trying to make a jetpack joyride concept game on corona. First of all unlike other sdk where when you change a scene, the previous scene is automatically removed, in corona you have to remove each and object and function yourself.

After a week I was finally able to remove objects while changing scene, but now I have ran into a new problem. Everytime when I change scenes and come back to the gameScreen the speed of lasers and missiles increases every time ( maybe twice? ). How can I reset its speed? I even added another “gameStatus” variable to remove the event listener and tried to print it, but game status never actually returned “ended”, it was always “running”. I am attaching the game files. Keep clicking on the white square in the center of the screen and see how speed increases with every click.

Try this out:

  1. If you are using purging on changing game screen, instead use storyboard.removeAll().

  2. If you are using enterframe for maintaining speed of lasers and missiles, check to remove it on scene changing.

I am using composer instead of storyboard… and I removed the event listener while destroying scene but still no luck.

function scene:destroy( event )

    gameStatus = “ended”

    timer.cancel(spawnit)

    image:removeEventListener( “touch”, image )

    Runtime:removeEventListener( “enterFrame”, onEnterFrame )

end

I also uploaded my code but cant see it anywhere here… Would you like me to upload it to dropbox or something for you to have a look?

Can you please provide your code as dropbox link or attach a zip file so that we can go through it.

Here is the link.

https://www.dropbox.com/sh/d7hv9f8v87plmpm/FTydQnysnI

I have ripped off the extra code. I also noticed something, For example if 3 objects have already spawned then after reloading the screen, only first 3 objects seem to be fast and its normal from fourth. So just let some lasers spawn and then click on the white box in the centre, to redirect to an empty startScreen and then coming back.

Try this out:

  1. If you are using purging on changing game screen, instead use storyboard.removeAll().

  2. If you are using enterframe for maintaining speed of lasers and missiles, check to remove it on scene changing.

I am using composer instead of storyboard… and I removed the event listener while destroying scene but still no luck.

function scene:destroy( event )

    gameStatus = “ended”

    timer.cancel(spawnit)

    image:removeEventListener( “touch”, image )

    Runtime:removeEventListener( “enterFrame”, onEnterFrame )

end

I also uploaded my code but cant see it anywhere here… Would you like me to upload it to dropbox or something for you to have a look?

Can you please provide your code as dropbox link or attach a zip file so that we can go through it.

Here is the link.

https://www.dropbox.com/sh/d7hv9f8v87plmpm/FTydQnysnI

I have ripped off the extra code. I also noticed something, For example if 3 objects have already spawned then after reloading the screen, only first 3 objects seem to be fast and its normal from fourth. So just let some lasers spawn and then click on the white box in the centre, to redirect to an empty startScreen and then coming back.