A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Why does my game run slow after a while?

  1. #1
    Senior Member
    Join Date
    Oct 2008
    Posts
    120

    Why does my game run slow after a while?

    It's a small arcade type game. All shots are unloaded. All enemies are unloaded after they are hit. There's only 2 for loops in the bullet mc to check if its hitting any of my 2 enemies. I mean, I can't think of anything else that is causing this. I've never had this problem before.

    any suggestions?

  2. #2
    Senior Member hatu's Avatar
    Join Date
    Jan 2007
    Posts
    480
    Some array growing constantly?
    http://hatu.biz
    Portfolio & games

  3. #3
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    There are tons of threads on here about optimizing code.

    This is from the main page: http://board.flashkit.com/board/showthread.php?t=780650

    But, you say that the for loops are in the bullet movieclip? It'd be best to have one main loop on the main timeline that iterates over all active bullets.

  4. #4
    Senior Member
    Join Date
    Oct 2008
    Posts
    120
    ya I do all my code in frame code. I meant, I have the bullet mc code in its time line, you know.

    nice thread btw,

    but actually I think the problem is my particle explosion effect.
    lemme test something...

    EDIT: yup, I was just reducing the alpha of the particles, and not unloading them. Problem solved!
    Last edited by DeadRiver; 12-05-2008 at 09:45 AM.

  5. #5
    Intermediate Game Dev pseudobot's Avatar
    Join Date
    May 2008
    Location
    New Zealand
    Posts
    561
    Are you unloading the bullets using removeMovieClip(target), or unloadMovie(target)?
    Needs an update...

  6. #6
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    Most likely you're not removing your particles properly. What are you using movieclips or bitmap data?

    Run through debug and check your variables

  7. #7
    Senior Member
    Join Date
    Oct 2008
    Posts
    120
    I use, this.unloadMovie();

    should I be doing something else?

  8. #8
    Intermediate Game Dev pseudobot's Avatar
    Join Date
    May 2008
    Location
    New Zealand
    Posts
    561
    ^Yep, for some reason the stuff stays in the memory. For a complete unload, use

    PHP Code:
    removeMovieClip(target); 
    Needs an update...

  9. #9
    Senior Member
    Join Date
    Oct 2008
    Posts
    120
    oh, I never knew the difference, thank you!

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