C
captiongoosebut
Guest
I want to set the variable "spd" to "spd * 0.707" while the player is moving diagonally to normalize diagonal movement speed.
I could make a bunch of if statements saying something like if key_a and key_w diagonal == true, etc, but that would be (I think) very inefficient, and have problems as well. If anyone has done this before and has recommendation please let me know.
Here is my movement code:
I could make a bunch of if statements saying something like if key_a and key_w diagonal == true, etc, but that would be (I think) very inefficient, and have problems as well. If anyone has done this before and has recommendation please let me know.
Here is my movement code:
Code:
key_up = keyboard_check(ord("W"));
key_left = keyboard_check(ord("A"));
key_down = keyboard_check(ord("S"));
key_right = keyboard_check(ord("D"));
var hMove = key_right - key_left;
var vMove = key_up - key_down;
hsp = hMove * spd;
vsp = vMove * spd;