A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [CS3] Choppy animation, help!

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    5

    [CS3] Choppy animation, help!

    Okay, so since my last ill-fated post, I've made leaps and bounds over what I had before. To give a quick recap, I used a person's flash platformer engine [flash 8] as a starting point for my own [updated to CS3] and have been befoogled in a few ways. I've solved most of my issues from the other post, however one in particular remains:

    Whenever there is more than one moving object within the viewing area, the entire game/animations slow down tremendously (at the moment, a cloud and a placeholder for an enemy are making this happen, a mc animation and animated by code, respectively).

    Can anyone think of a reason/fix for this? I can supply codes if that helps.

    Also, I've begun trying to figure out how to "save" data for later regurgitation. That is, if I were to use multiple frames in the game and I wanted the game to remember whether certain interactions had been achieved or not no matter which frame you are in.

  2. #2
    Member Pepember
    Join Date
    Jul 2001
    Location
    Berlin
    Posts
    886
    keeping track of game achievements might be done using variables on the root timeline. they are independent of the current frame.
    you could init them on the first frame, e.g.:
    PHP Code:
    var highscore:Boolean false;
    var 
    score:Number 0;
    var 
    secretsUnlocked:Number 0
    then, within your game loop (or similar code structure, i.e. the code that checks the game progress) you address these variables, e.g.:
    PHP Code:
    if (_root.score >= currentHighscore){
    _root.highscore true;
    }
    if (
    secretFound){
    _root.secretsUnlocked++;

    and so on.

    as to your slowdown problem:
    can't say, it really depends on a lot of factors. maybe post a fla?
    Please sign here

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    Okay, here it is, I had to shave off some visuals to fit the 300kb size, but the important elements are still there.
    My enemies are pretty simple at the moment, but I'm coming along with them well enough.
    Enginetest.fla

    Also, thanks for the achievement code! I was sifting through shared/tempsave methods that were going nowhere and this helps a whole bunch.

  4. #4
    Member Pepember
    Join Date
    Jul 2001
    Location
    Berlin
    Posts
    886
    i didn't notice any slowdown, the cloud and the enemies move along swiftly. one thing though:
    whenever you use onEnterFrame events, put this at the end of the event code:
    updateAfterEvent();
    by standard, onEnterFrame events are executed depending on your frame rate, i.e. in your case 30 times per second. if the client computer cannot deal with this frame rate due to a slow cpu the code will be executed at a slower frame rate. putting the above statement at the end of your code will execute the event code again whenever it has been completely executed thus making it more or less independent from the actual frame rate.
    Please sign here

  5. #5
    Junior Member
    Join Date
    Sep 2008
    Posts
    5
    Huh, well I guess you're right (it seems to come and go, but I am very tired atm), thanks anyways! I'll try that out for sure.

    But now to make those red blocks do something destructive! Wee!

    ...after some sleep.

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