the Test where the Guns wont appear on the character:
oPowerUp Create:
/// @description Vars
// No Poweerup
weapons[0] = ds_map_create();
ds_map_add(weapons[0],"sprite",-1);
ds_map_add(weapons[0],"Recoil",0);
ds_map_add(weapons[0],"Recoil_Push",0);
ds_map_add(weapons[0],"damage",0);
ds_map_add(weapons[0],"projectile",-1);
ds_map_add(weapons[0],"startup",0);
ds_map_add(weapons[0],"length",0);
ds_map_add(weapons[0],"cooldown",0);
ds_map_add(weapons[0],"bulletspeed",0);
ds_map_add(weapons[0],"automatic",false);
//Pistol
weapons[1] = ds_map_create();
ds_map_add(weapons[1],"sprite",sPistolHeld);
ds_map_add(weapons[1],"Recoil",1);
ds_map_add(weapons[1],"Recoil_Push",0);
ds_map_add(weapons[1],"damage",2);
ds_map_add(weapons[1],"projectile",oBullet);
ds_map_add(weapons[1],"startup",0);
ds_map_add(weapons[1],"length",2);
ds_map_add(weapons[1],"cooldown",1);
ds_map_add(weapons[1],"bulletspeed",0);
ds_map_add(weapons[1],"automatic",false);
//MachineGun
weapons[2] = ds_map_create();
ds_map_add(weapons[2],"sprite",sMachinegunHeld);
ds_map_add(weapons[2],"Recoil",2);
ds_map_add(weapons[2],"Recoil_Push",0);
ds_map_add(weapons[2],"damage",3);
ds_map_add(weapons[2],"projectile",oBullet);
ds_map_add(weapons[2],"startup",0);
ds_map_add(weapons[2],"length",2);
ds_map_add(weapons[2],"cooldown",1);
ds_map_add(weapons[2],"bulletspeed",10);
ds_map_add(weapons[2],"automatic",true);
//Shotgun
weapons[3] = ds_map_create();
ds_map_add(weapons[3],"sprite",sShotgunHeld);
ds_map_add(weapons[3],"Recoil",4);
ds_map_add(weapons[3],"Recoil_Push",5);
ds_map_add(weapons[3],"damage",20);
ds_map_add(weapons[3],"projectile",oBullet);
ds_map_add(weapons[3],"startup",3);
ds_map_add(weapons[3],"length",2);
ds_map_add(weapons[3],"cooldown",4);
ds_map_add(weapons[3],"bulletspeed",5);
ds_map_add(weapons[3],"automatic",false);
//Sniper
weapons[4] = ds_map_create();
ds_map_add(weapons[4],"sprite",sSniperHeld);
ds_map_add(weapons[4],"Recoil",4);
ds_map_add(weapons[4],"Recoil_Push",2);
ds_map_add(weapons[4],"damage",15);
ds_map_add(weapons[4],"projectile",oBullet);
ds_map_add(weapons[4],"startup",3);
ds_map_add(weapons[4],"length",2);
ds_map_add(weapons[4],"cooldown",4);
ds_map_add(weapons[4],"bulletspeed",15);
ds_map_add(weapons[4],"automatic",false);
//Bazoka
weapons[5] = ds_map_create();
ds_map_add(weapons[5],"sprite",sBazookaHeld);
ds_map_add(weapons[5],"Recoil",5);
ds_map_add(weapons[5],"Recoil_Push",10);
ds_map_add(weapons[5],"damage",5);
ds_map_add(weapons[5],"projectile",oRocket);
ds_map_add(weapons[5],"startup",5);
ds_map_add(weapons[5],"length",2);
ds_map_add(weapons[5],"cooldown",5);
ds_map_add(weapons[5],"bulletspeed",15);
ds_map_add(weapons[5],"automatic",false);
//Equiped
weapon = 0;
Ammo[array_length_1d(weapons)-1] = 0;
Ammo[0] = 0;
//Equip New Weapon
ChangeWeapon(0);
//Recoil
current_cd = 0;
current_delay = -1;
current_recoil = 0;
oPowerUp Step:
/// @description Powerups
// Gun Align
x = oPlayer.x;
y = oPlayer.y;
direction = point_direction(x,y, mouse_x, mouse_y);
if (direction > 90) && (direction < 270) image_yscale = -1; else image_yscale = 1;
image_angle = direction;
//Shooting
var MouseB;
if (automatic) MouseB = mouse_check_button(mb_left); else MouseB = mouse_check_button_pressed(mb_left);
if (MouseB)
{
if (current_cd == 0)
{
current_cd = cooldown;
current_delay = startup;
}
}
if (current_cd == 0) && (projectile != -1)
{
if (Ammo[weapon] != 0)
{
with (instance_create_layer(x+lengthdir_x(length,direction), y+lengthdir_y(length,direction), "Instances_Bullet", projectile))
{
direction = other.direction;
speed = other.bulletspeed;
}
Ammo[weapon] -=1;
}
with (oPlayer)
{
x_speed -= lengthdir_x(other.Recoil_Push,other.direction);
y_speed -= lengthdir_y(other.Recoil_Push,other.direction);
}
current_recoil = recoil;
}
current_delay = max(-1,current_delay-1);
if (current_delay == -1) current_cd = max(0,current_cd-1);
current_recoil = max(0,floor(current_recoil*0.8));
depth = oPlayer.depth-1;
oPowerUp Draw:
/// @description Draw Weapons
// show Weapons
if (sprite != -1)
{
draw_sprite_ext(
sprite,
image_index,
x-lengthdir_x(current_recoil, direction),
y-lengthdir_y(current_recoil, direction),
image_xscale,
image_yscale,
image_angle,
image_blend,
image_alpha
);
}
litteraly the same code as the afore mentioned game how is this not working?
https://drive.google.com/file/d/1FxyFHoqLz0BZ8VgAw_i_rTsoPC5TMAvX/view?usp=sharing - the Guns not working properly