Role movement step, step speed and sliding phenomenon

xiaoxiao2021-03-06  41

Sliding is only related to the steps, it is a pixel that is actually moving (or run) actual movement. Of course, domestic games are not good. Most of the players don't care about the player of the characters, simple frames of frames play animations, and move the small person in the map. The method of preventing sliding can also change the moving speed of the character is such that the program will be controlled by the step size and steps. The steps must be killed, and a small group of people in the picture made, the moving pixels are subject to. Step speed is arbitrary, you can use the game per frame or every 1/100 seconds, the number of pixels moved (can be a decimal, such as a new mobile 1.2 pixels per frame). Simplified explanation, I am from the horizontal level of movement. Example: (Lace angle can be pushed) hypothesis step is STEP (Pixel), the step rate is SPEED (Pixel / frame), and the number of people walking animation frame is n (frame). Note: The STEP and SPEED can be a decimal; n is an integer. All the following operations are all floating point operations, and the real game consider using the fixed point. Now you have to move the characters from the coordinate 0 to 100. We can calculate, this process is required to be 100 / speed frames. Then the IF picture, the person is in the location: POS = i * 100 / speed this time, need to draw a second image image? First we need to know the IF picture, that is, POS location, the characters have already gone t = | POS / step | step (tethered); our villain is walking in the tw 1 M = ( POS-T * STEP) * 100% time m is a number between 0 to 1. f = | n * m | is that we need to draw the walking picture frame at this moment. Accelerate walking speed, not to accelerate the frequency, it is impossible to cause sliding, because the distance taken is not changed at all. PS. For running, there is a vacancy, slight sliding is allowed, so the step size can be appropriately increasing.

转载请注明原文地址:https://www.9cbs.com/read-51574.html

New Post(0)