Hello! I hope this is in the right place! I am extremely new to... well... everything. I've picked up Game Maker as a way to sort of teach myself some basic programming stuff before moving on to a full language. It also provides a nice environment to teach myself simple animation, pixel art, and level design. I apologize in advance for my vast ignorance.
I'm working on my first "engine" for a side scrolling brawler/beat em up and I have hit a snag when it comes to movement. The code works just fine when using the arrow keys, which is the code posted below.
However, if I replace the (vk_key) to (ord('A') etc, my character only moves at the correct speed backwards and up, but extremely slow forwards and down. I'm not sure why this is.
Could somebody take a look at this code and help me understand why this is happening? Or, if possible, provide some completely different code to accomplish the same thing?
Thank you so much!
// character movement
vx = (keyboard_check(vk_right) - keyboard_check(vk_left)) * 10;
vy = (keyboard_check(vk_down) - keyboard_check(vk_up)) * 10;
if (place_free(x, y + vy))
{
y += vy;
}
if (place_free(x + vx, y))
x += vx;