I am using game maker because I am new to game development and I think it's the easiest to understand because I took a course on it but I put in all the events so that my playerobj moves when you press the A and D keys but when I load up the game it doesn't work here is the GML code below that I am using:
//Speed of player: 5 Pixels per frame
playerSpeed = 5;
//Shortcuts for keypresses
MOVELEFT = keyboard_check(ord('A'));
MOVERIGHT = keyboard_check(ord('D'));
MOVEUP = keyboard_check(ord('W'));
MOVEDOWN = keyboard_check(ord('S'));
//Move Player
if (MOVELEFT && x > sprite_width/2)
{
x -= playerSpeed;
}
if (MOVERIGHT && x < room_width - sprite_width/2)
{
x += playerSpeed;
}
if (MOVEUP && y > room_height/2)
{
y -= playerSpeed;
}
if (MOVEDOWN && y < room_height - sprite_width/2)
{
y += playerSpeed;
}