A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [Problem]: as game advances, its getting laggy

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    1

    [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.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center