Skip to main content
Participant
December 16, 2010
Question

Scrolling problem in my platform game

  • December 16, 2010
  • 1 reply
  • 360 views

For the past few weeks i've been working on a tile based side scrolling platform game. The game is programmed in actionscript 3 and uses the on enter frame functionality to carry out just about all of it's tasks. But ive noticed that while playing the game, the scrolling will occasionally become choppy. it seems like the framerate dramatically drops for a few seconds and then it will become smooth again. I have it set to 60 fps but it's wierd that it will occasionally become slow and laggy for a few seconds. Is there anything I could have done in the programming to cause this? or is there any way I could possibly fix the issue? Any help would be appreciated, thanks!

-Tony

This topic has been closed for replies.

1 reply

MikesNameIsMike
Inspiring
December 17, 2010

There are a million things in your code that could be causing that.

Make sure you use all the standard code optimization techniques - declare variables as little as possible/ reuse them as much as possible, don't use Number when int will get the job done, don't repeat an action inside a loop that can be done once outside the loop.  Never use division, when you can use multiplication. Y = X / 2;  will take much longer to process then Y = X * .5;

  Things like that all make a big difference when you are tryign to run all your logic 60 times per second.  Optimization of code is a big subject, but some basic rules will save you a ton of wasted processes.  Read this: http://gamedev.michaeljameswilliams.com/2010/02/10/optimise-as3-for-speed/