W
Wicked
Guest
So basically, the code at the top of both spoilers is supposed to have it so when I pick up one weapon, the other is dropped to the floor. However, it only works if I have the gun and try to pick up the axe, if I have the axe and try to pick up the gun it just moves the gun.
Axe Code
Gun code
Pickup code
Axe Code
if(instance_exists(obj_GunReal))
{
instance_destroy();
instance_create_layer(obj_Player.x,obj_Player.y, "GunLayer", obj_Axe);
}
x=obj_Player.x+5;
y=obj_Player.y-9;
image_angle = point_direction(x,y, mouse_x, mouse_y);
firingdelay = firingdelay - 1;
recoil = max(0,recoil - 1);
if (mouse_check_button(mb_left)) && (firingdelay <0)
{
recoil = 10;
firingdelay = 25;
with(instance_create_layer(x,y,"Bullets",obj_MeleeSwing))
{
speed = 5;
direction = other.image_angle + random_range (-3, 3);
image_angle = direction;
}
if (global.Nails = 1){
recoil = 5;
firingdelay = 11;
repeat (4){
with(instance_create_layer(x,y,"Bullets",obj_Nailjectile))
{
speed = 15
direction = other.image_angle + random_range(-9, 9);
image_angle = direction;
}
}
}
x = x - lengthdir_x(recoil, image_angle);
y = y - lengthdir_y(recoil, image_angle);
if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
}
else
{
image_yscale = 1;
}
}
{
instance_destroy();
instance_create_layer(obj_Player.x,obj_Player.y, "GunLayer", obj_Axe);
}
x=obj_Player.x+5;
y=obj_Player.y-9;
image_angle = point_direction(x,y, mouse_x, mouse_y);
firingdelay = firingdelay - 1;
recoil = max(0,recoil - 1);
if (mouse_check_button(mb_left)) && (firingdelay <0)
{
recoil = 10;
firingdelay = 25;
with(instance_create_layer(x,y,"Bullets",obj_MeleeSwing))
{
speed = 5;
direction = other.image_angle + random_range (-3, 3);
image_angle = direction;
}
if (global.Nails = 1){
recoil = 5;
firingdelay = 11;
repeat (4){
with(instance_create_layer(x,y,"Bullets",obj_Nailjectile))
{
speed = 15
direction = other.image_angle + random_range(-9, 9);
image_angle = direction;
}
}
}
x = x - lengthdir_x(recoil, image_angle);
y = y - lengthdir_y(recoil, image_angle);
if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
}
else
{
image_yscale = 1;
}
}
if(instance_exists(obj_AxeHand))
{
instance_destroy();
instance_create_layer(obj_Player.x,obj_Player.y, "GunLayer", obj_GunSprite);
}
x=obj_Player.x+5;
y=obj_Player.y-9;
image_angle = point_direction(x,y, mouse_x, mouse_y);
firingdelay = firingdelay - 1;
recoil = max(0,recoil - 1);
if (mouse_check_button(mb_left)) && (firingdelay <0)
{
recoil = 4;
firingdelay = 10;
with(instance_create_layer(x,y,"Bullets",obj_Bullet))
{
speed = 15;
direction = other.image_angle + random_range (-3, 3);
image_angle = direction;
}
if (global.Nails = 1)
{
recoil = 5;
firingdelay = 11;
repeat (4){
with(instance_create_layer(x,y,"Bullets",obj_Nailjectile))
{
speed = 10
direction = other.image_angle + random_range(-150, 150);
image_angle = direction;
}
}
}
}
x = x - lengthdir_x(recoil, image_angle);
y = y - lengthdir_y(recoil, image_angle);
if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
}
else
{
image_yscale = 1;
}
{
instance_destroy();
instance_create_layer(obj_Player.x,obj_Player.y, "GunLayer", obj_GunSprite);
}
x=obj_Player.x+5;
y=obj_Player.y-9;
image_angle = point_direction(x,y, mouse_x, mouse_y);
firingdelay = firingdelay - 1;
recoil = max(0,recoil - 1);
if (mouse_check_button(mb_left)) && (firingdelay <0)
{
recoil = 4;
firingdelay = 10;
with(instance_create_layer(x,y,"Bullets",obj_Bullet))
{
speed = 15;
direction = other.image_angle + random_range (-3, 3);
image_angle = direction;
}
if (global.Nails = 1)
{
recoil = 5;
firingdelay = 11;
repeat (4){
with(instance_create_layer(x,y,"Bullets",obj_Nailjectile))
{
speed = 10
direction = other.image_angle + random_range(-150, 150);
image_angle = direction;
}
}
}
}
x = x - lengthdir_x(recoil, image_angle);
y = y - lengthdir_y(recoil, image_angle);
if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
}
else
{
image_yscale = 1;
}
if (distance_to_object(obj_GunSprite) < 32 ){
instance_create_layer(obj_GunSprite.x, obj_GunSprite.y, "GunLayer", obj_GunReal);
}
if (distance_to_object(obj_Axe) < 32 ){
instance_create_layer(obj_Axe.x, obj_Axe.y, "GunLayer", obj_AxeHand);
}
instance_create_layer(obj_GunSprite.x, obj_GunSprite.y, "GunLayer", obj_GunReal);
}
if (distance_to_object(obj_Axe) < 32 ){
instance_create_layer(obj_Axe.x, obj_Axe.y, "GunLayer", obj_AxeHand);
}