No mouse input possible with WASD keys movement

P

PixelPluto

Guest
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
 
P

PixelPluto

Guest
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.
 
P

PixelPluto

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

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

PixelPluto

Guest
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...
 
P

PixelPluto

Guest
Well, I'll see what I can/will do.

Anyways, thank you all for your replies :) !
 
P

Pingu_Penguin

Guest
I know this thread is old but......

I had the same issue, it was really bugging me but I found the solution. It is to do with the touchpad I found the following regedit for the touchpads in most laptops on another forum so the instructions are not my own but it did work


1) Type in search bar "regedit" and hit enter

2) after allowing the app to make changes to your device proceed with the following

3) HKEY_LOCAL_MACHINE > SOFTWARE > Synaptics > SynTP and then click on TouchPad

4) From there double-click "PalmDetectConfig"

5) For "Value Data" enter 0 into either Hexadecimal or Decimal values and click "Okay"

6) Restart computer

link to the forum on Microsoft answers
 
Top