Falling objects slow down

Done

Now i really need a solution :disappointed_relieved:

@coderm8,

Hi.  I haven’t really read through the code too much, as I’m not a fan of big code posts.  Also, I find that one scene file is generally not the whole picture. i.e. The problem could be somewhere else entirely.

My guess is you’re not deleting all of your objects.  Eventually, there will be too many physics objects and the game slows down.

One way to check for this is to see if your memory usage grows and grows over time.  This indicates a memory leak.

  • Get SSK2 and copy the folder to your game: https://roaminggamer.github.io/RGDocs/pages/SSK2/

  • Add this code at the top of main.lua

    require “ssk2.loadSSK” _G.ssk.init() – START METERS ssk.meters.create_fps(true) ssk.meters.create_mem(true)

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/meters/

Now run the game and see how memory behaves as you play, and play, … till the slowdown.

Other than that, I’d have to see the whole project.  So, if it worth it to you and you are still stuck in a few days, consider trying the Hitman route: https://forums.coronalabs.com/topic/69420-hire-a-hitman-problem-solver-is-back/

Are you sure these lines are working?

Runtime:removeEventListener ("enterFrame",event.self )

Maybe try

Runtime:removeEventListener ("enterFrame",event.target )

Rob

It is still not working the objects fall really slowly after a period of time

Who are you responding to and what did you change?

[lua] Runtime:removeEventListener (“enterFrame”,event.self )[/lua]

[Lua] Runtime:removeEventListener (“enterFrame”,event.target ) [/lua]

I changed this

Sorry, but I think I’m going to drop out of this conversation.   (I have a limited time budget to provide free help and I’m afraid I have used it up for today.)

Please re-read my post above and consider a hit or alternately zipping up the whole project and sharing it here for input from the community at large.

I don’t even bother reading code that is so badly formatted… If you want help then put the effort in.  Suggest you spend time with the tutorials.

Writing this for others…

General pointers (reiterating good advice already given)… slow down over time normally means you are not removing objects and therefore Corona spends more and more time checking display objects for visibility. 

Other factors are multiple events - i.e. events being added but not removed will compound over time. 

Never ending timers are generally bad form and enterFrame() is much better, easier to read and easier to debug.

Loading audio in scene:show() is bad practise.

Hiding functions in scene events is bad practise.