Abdur Olajuwon
Member
I been needing help on this for about 2 days now, but when the ammo count goes to zero for certain power ups, I want the player to go back to his normal shooting. What happens is after the count does down to zero, he is still firing the power up projectiles.
Machine Gun Script
Normal Shoot Script
Machine Gun Script
GML:
///Machine Gun Ammo Script
function scr_machinegunammo(){
if machinegun_ammo > 1
{
machinegun_ammo -= 1
}
else
{
machinegun_ammo = 0
scr_normalshoot()
}
}
Code:
// / @desc Normal Shooting
function scr_normalshoot(){
if gamepad_button_check(0,gp_face3) && canShoot
{
canShoot = false
alarm[0] = shoot_delay
var dir = 0;
if gamepad_axis_value(0,gp_axislh) = 0
&& gamepad_axis_value(0,gp_axislv) = 0
{
if image_xscale < 0 //if facing left
{dir = 180}
//an else isn't needed cus the dir is already 0
}
else
{dir = point_direction(0, 0, gamepad_axis_value(0,gp_axislh), gamepad_axis_value(0,gp_axislv))}
with (instance_create_layer(x,y,"BULLETS",obj_projectile))
{
direction = dir;
speed = 20;
}
}
}