actionscript 3 - AS3 What causes lag with side scrollers? -


I am programming a side scroller based on the tutorial I found in a book. My friend did this, and he is working perfectly.

I have just changed some variable names (I did the animation differently), but for some reason, when my character is running, there is a large amount of interval.

HOwever intervals are only present when there are 'walls' on the stage.

Both walls and floors use the same code (both of them are referred to as the 'flow object' variable) and use the same collision code, although I do not Find out why the intervals are involved.

If the character is omitted, then by the character (about 60x) starts, there is a large amount of interval. If I'm fine, there is not much gap until the screen starts scrolling.

The interval since moving to the left is to believe that something can happen with the program preventing the scroll from scrolling but I do not understand why the interval trying to move right is.

I've listed the scroll code, and I can upload the collision code if needed, and if the main loop,

  public function scrollGame () {var Forum Status: number = gameLevel.x + player.mc.x;  

Var Rightage: Number = Stage. Stagewidth - AngDestens; Var leftEdge: number = side diagram; // Scroll to the game level on the left if the player takes the right step (stageposition & gt; right edge) {gameLevel.x - = (step-position - right agage); // Stop game preventing sloosing (gameLevel.x <- (gameLevel.width-stage.stageWidth)) gameLevel.x = - (gameLevel.width-stage.stageWidth); } // Scroll the game level to the right if the player moves (stageposition & left; left edge) {gameLevel.x + = (left edge - phase position); // if game (gameLevel.x> 0) gameLevel.x = 0; Prevent game from scrolling from the platform; }}

Main Loop:

  Public Function Gamelup (e: Event) {// Get the Time Difference if (Last Time == 0) Last time = getTimer (); Var Time Diff: int = getTimer () - the last time; Last Time + = Timedream; // Play bicycle functions only if display in game mode (gameMode == "play") {moveCharacter (player, timeDiff); MoveEnemies (timeDiff); CheckCollisions (); ScrollGame (); }}  

update:

So I've done this "profiles", most of the time spent using the GooAndStop () command in the MoveCharacter () function going . So I removed it, and there was no difference, it is still cold. I still fired the enemies, still cold. But in order to reduce the quality, it has been fixed in some way (though at a poor quality now) is there any way that is due to the interval and how it is decided?

I know what will be missing in your flag?

Game.

This is an estimate, and I get this error some time.

Make sure your images are optimized!

If they are importing from the photo store or IkalTro Flash must deal with those complex vector points.

Use .png for transparent images, either bitmap does not hurt.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -