B
bobosen
Guest
Hey guys, so my project is coming along nicely thanks to you, it's a split screen shooter but i discovered something today.
Player1 uses mouse and keyboard, he can shoot 360 degrees around him BUT, anytime mouse hovers over player2 screen, the angle of Player1's gun changes to whatever sprite is shown on player2 screen. This is of course because the code is written to follow x and y coordinates.
Is it possible to limit mouse movement to viewport 0? I don't want to physically stop the mouse cursor at the split cause that's akward, I just want the program to not register the x and y coordinates of player 2 screen. Hope it makes sense, thanks
Here's the code from the gun shooting bullets (thanks Shaun Spalding)
Player1 uses mouse and keyboard, he can shoot 360 degrees around him BUT, anytime mouse hovers over player2 screen, the angle of Player1's gun changes to whatever sprite is shown on player2 screen. This is of course because the code is written to follow x and y coordinates.
Is it possible to limit mouse movement to viewport 0? I don't want to physically stop the mouse cursor at the split cause that's akward, I just want the program to not register the x and y coordinates of player 2 screen. Hope it makes sense, thanks
Here's the code from the gun shooting bullets (thanks Shaun Spalding)
GML:
/// @description Insert description here
// You can write your code in this editor
x = oPlayerAttack.x-0;
y = oPlayerAttack.y-10;
image_angle = point_direction(x,y,mouse_x,mouse_y);
firing_delay = firing_delay - 1;
recoil = max(0, recoil - 1);
if (mouse_check_button(mb_left)) && (firing_delay < 0)
{
firing_delay = 5;
recoil = 4;
with (instance_create_layer(x,y,"Bullets",oBullet))
{
speed = 16;
direction = other.image_angle + random_range(-2,2)
image_angle = direction;
}
}