Burst Fire Problem

Okay so now here's a question that's going to take showing multiple events. I'm trying to make a burst fire for one of my ships. So far it's working but only works the first time the button is pressed. It's not resetting somehow after the first burst.
Here's the Create event:
Code:
bulletCounter = 4;
canFire = 1;
Step event:
Code:
if keyboard_check_pressed(ord("F")){
    if (canFire = 1){
        if (bulletCounter >= 1){
            create_bullet2(image_angle, bulletSpd, faction);
            bulletCounter--;
            alarm[4] = room_speed/8;
        }
    }
}
if (bulletCounter < 1){
    canFire = 0;
}
if (bulletCounter <= 0){
    alarm[0] = room_speed/.5;
}
Alarm 0:
Code:
canFire = 1;
Alarm 4:
Code:
bulletCounter -= 1;
create_bullet2(image_angle, bulletSpd, faction);
if (bulletCounter > 0){
alarm[4] = room_speed/8;
}
if (bulletCounter <= 0){
alarm[0] = room_speed/.5;
}
And some of this code probably is redundant but are just my attempts at making it work.
 

TsukaYuriko

☄️
Forum Staff
Moderator
How can it reset if you never add anything to bulletCounter or set it to anything outside of the Create event? ;)
 
Top