Bullet firerate

Hello. I’m trying to get 2 different bullets to fire at different rates from my player. I’ve tried using object timers following the wiki, but can’t get the player to fire at all? What am I doing wrong?

You are setting a timer of an object when the object bullet it doesn’t exists yet that’s why you never fire any bullet.
Plus try the extension Every x seconds is a better way to implement what you want to do, let’s say this in events.

Conditions
Every 0.25 seconds
Player is pressing fire button…
Action:
Create bullet
Set bullet position and angle if needed.

Done.

Can’t find that extension, what is it called. “every x”? I’m not familiar with gdevelop, or coding in general.

Ok. I tried what you said, but it still doesn’t work.

Hi, just a question - maybe also on behalf of Ulises - for understanding the problem, what exactly does not work? You cannot shoot with the events?

Yes. But I think it was because I didn’t install the “repeat x seconds” behavior in my player object first? Either way I got it working, but in a different way. I still need help managing the timing of the different bullets. Right now I have 2 different bullets firing from my player. One timer is being managed through the level events, the other bullet timing is being managed through the player object behaviors. It doesn’t seem ideal, especially if I add more than 2 bullets. How can I manage the timing better?

You want to shoot two different bullet types one after another?
At the moment you have one action (press fire button) that does two different things at once. The first one has no timer and I guess it spawns bullets in a line without any break - you mentioned it is managed by the player object behavior and it works as intended?

I would give each bullet type its own timer in the events. You can have as much timers as you want, you just need to give them different names.

1 Like

Ok. Yes I want two different bullet types shooting from my player when I press the fire button, maybe more. Since the first bullet doesn’t have a timer in events, the cooldown fire bullet behavior is managing it in my player object. Ok, so I just have to make a timer also for the first one, and can continue to add more bullets the same way! Thanks. It’s working! I didn’t realize I could name them whatever I wanted.

1 Like