performance - Is it better to count n ticks or run two seperate timers -


I am making a snake game and snake all the way because snake is running a whole unit on each tick, jumping animation is. The game is on an invisible grid so that snakes can change direction only at specific points.

Is it considered to be a better practice to keep the timer, which will take the snake at the time of counting one pixel with one variable, and the code will be run to change direction on every nick. Or better to keep two different timers; To move the snake one pixel and change the direction of the snake to each other?

Basically, you create "view-loop" to update DisplayList Has been and drag your view again. When the game gets complicated, listening for the timer and the ENTER_FRAME event will be constrained in the flashplayer setting for the screen refresh (i.e. this fps) and based on the CPU rendering process, depending on the work it does.

Frame-rate independent animation, you should probably use a combination of ENTER_FRAME to track the media sequence and call for more precise call (millisecond) call animation and experience in different platforms. Make normal

Actually, listen to the ENTER_FRAME event, check the current millisecond since the last update, and if it is higher than your refresh rate (in relation to milliseconds), the animation / status update will stop Do: Check to find snake collision with "direction block" - if correct, then update the snake's movement / condition / status.

In whatever setting the display updates the flash, and CPU / machine-based problems are key, I have found, to make sure that you have the experience to normalize the speed of updates Are making Timer is their use, but memory performance can cause problems. ENTER_FRAME is synchronized with the main timeline / frame-rate setting

For a dated but interesting discussion 3 years ago,

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -