-
[Problem]: as game advances, its getting laggy
Hey guys,
i've been working on a game.
the main idea is that the player needs to catch good stuff that falling from above, and to avoid bad stuff.
the problem is that after a short time, the game is getting laggy....
my first thought was "the falling MCs doesn't removed!"
so i tried typing
Actionscript Code:
parent.removeChild(this);
which made the MC vannish.
but the game still getting laggy as time goes by....
will appriciate any help!
Thanks,
Milky.
-
Senior Member
Even if you remove display objects from stage, they are not always removed from memory.
However, without knowing how your code looks like, my guess for increasing lag would be collision loop that gets incremented and never cleaned up.
Example, lets say you have loop to check for falling objects:
for(n = 0; n < numberOfFallingThings; n++){
}
And each time new object appears, numberOfFallingThings is increased by 1. As the numberOfFallingThings increases, loop takes longer and longer to work through all the objects, even when most of them are long gone.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|