How to go about "Plus % to movement speed"

inertias

Member
Suppose you want to create a low-res pixel art rpg that has items that affect your player. You want to create magical boots that increases the player's movement speed by something like +15%.

If you use super basic movement code, something like a keyboard input check that increases x or y by +1 in the step event, if you add 15% to that movement you'll notice that your sprite will start to shake as it moves with the viewport because x is now increasing by 1.15.

I realize that this is due to the player moving in non-integer values, but I'm certain that games like Diablo II for example have done this kind of thing without receive this distorted effect to its sprites.

So in short, how exactly would you go about coding this?
 

Smiechu

Member
You need to have i.e. additional coordinates temp_x / temp_y. Which are incremented with non integer values by your control system. Then at the end of the step they have to be transferred to standard x y with round or floor function (what siuts you better). This way your non integer incrementation is not lost every step.

But to be honest it won't help you, as one step your hero will move one pixel, and second step he will move 2 pixels, which will result in "shakey" movement either way. This is a draw back of low res game design. By higher resolutions the issue is not visible as the speed increment values are higher (i.e 10-20px).
First Diablo was designed in 640x480 resolution which counts as hi-res and from what I remember you could also see some slight "unevenly" movement when the hero got some movement upgrades.

Other possibility... make a non pixel perfect movement but it won't look nice.

Third option... play a litlle bit with frame rate... set it to higher value ie. 60, and make incrementation smaller i.e. 0.2 than your hero will move one pixel every 5 frames, and with 50% bonus (0.3) it wil move around one pixel every 3 frames.

Or other way, set the frame rate lower... and incrementarion to higher values.

You need to find something that suits you...
 
Top