Lightstone_Legend
Member
I tried giving my character 8 directional movement and it seems fine at first, but when I make him move diagonally he starts shaking violently and I don't know why.
Details:
The room size is 640x360.
The camera and viewport settings are 320x180 with following oPlayer.
And the player sprite is W: 36 and H: 57.
And the player script is here:
Any ideas?
Details:
The room size is 640x360.
The camera and viewport settings are 320x180 with following oPlayer.
And the player sprite is W: 36 and H: 57.
And the player script is here:
Code:
//Create event
image_speed = 1;
hSpeed = 0;
vSpeed = 0;
walkSpeed = 1;
Code:
//Step event
keyLeft = keyboard_check(vk_left) or keyboard_check(ord("A"));
keyRight = keyboard_check(vk_right) or keyboard_check(ord("D"));
keyUp = keyboard_check(vk_up) or keyboard_check(ord("W"));
keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
inputDirection = point_direction(0,0,keyRight-keyLeft,keyDown-keyUp);
inputMagnitude = (keyRight - keyLeft != 0) || (keyDown - keyUp != 0);
hSpeed = lengthdir_x(inputMagnitude * walkSpeed, inputDirection);
vSpeed = lengthdir_y(inputMagnitude * walkSpeed, inputDirection);
x += hSpeed;
y += vSpeed;