No mouse input possible with WASD keys movement

PixelPluto

Member
So I played around a bit with Shaun Spalding's arena shooter tutorial (GML), and wanted to use the WASD keys for the movement instead of the arrow keys.

I then noticed that, when I press the WASD keys and the player is moving, the mouse pointer isn't moving at all, and while moving, I also cannot shoot (which happens by clicking the left mouse button). As soon as the player stops, the mouse pointer moves again and and I can shoot. As soon as the player moves, it's not working anymore.

I searched on the web for a solution to this, but unfortunately couldn't find anything. I also tried to find a work-around, but shouldn't the WASD keys work just the same way as the arrow keys?

Does someone else have the same issue? Could this be a bug?
 

Paskaler

Member
Maybe the problem is somewhere else in the code here. Maybe, while changing you modified some condition or something.

It would be helpful if you posted the code for the movement
 

PixelPluto

Member
I have this code in the player object, the Step event:

// Player movement (arrow keys)
//if (keyboard_check(vk_right)) x = x + 4;
//if (keyboard_check(vk_left)) x = x - 4;
//if (keyboard_check(vk_up)) y = y - 4;
//if (keyboard_check(vk_down)) y = y + 4;

//Player movement (WASD)
if (keyboard_check(ord("A"))) x = x - 4;
if (keyboard_check(ord("D"))) x = x + 4;
if (keyboard_check(ord("W"))) y = y - 4;
if (keyboard_check(ord("S"))) y = y + 4;

//Player towards mouse position
image_angle = point_direction(x, y, mouse_x, mouse_y);

// Create bullets, slow down bullets
if (mouse_check_button(mb_left)) && (bullet_slow < 1)
{
instance_create_layer(x, y, "ly_bullets", obj_bullet)
bullet_slow = 4;
}

bullet_slow = bullet_slow - 1;


And this code in the bullet object, Create event:

// Shooting from player object
direction = point_direction(x, y, mouse_x, mouse_y);
direction = direction + random_range(-4, 4);
speed = 16;
image_angle = direction;

I just did how Shaun Spaulding showed it in his tutorial.
 

TheouAegis

Member
the mouse pointer isn't moving at all, and while moving, I also cannot shoot (which happens by clicking the left mouse button)
When you say mouse pointer, are you talking about that little arrow that Windows has, or are you talking about a custom cursor that you use? At this point it sounds like there's a problem with your computer.
 

PixelPluto

Member
Yes, I mean the little arrow that Windows has...

If it's really my computer, I'll try the game on another computer.
 

PixelPluto

Member
I develop my games on a laptop, and it's probably the laptop's touchpad/left button that's not working with WASD. I plugged a USB mouse to the laptop, and then, the mouse worked with the WASD keys.

I tried it on a second laptop that I have, and the same problem occured: touchpad/left button of the laptop to shoot isn't working while pressing WASD, but it worked with the USB mouse.

Now I'm not really sure what to do about this...
 
Top