In this gdevelop tutorial:
I can understand this issue(paragraph). Please inform me.
Playing sound effects
We will add a laser sound effect that will be played when the player fires a bullet. Go to the FireBegin event. Add a new action to play a sound. Select “sfx_laser.ogg” from the assets folder, set volume to 100, and pitch to 1.
What part don’t you understand? It’s just saying to add another action to the existing event. The action plays the sound file “sfx_laser.ogg”. It plays it at a volume of 100 (full volume) and with a pitch of 1 (normal speed)
Use the following command when you click on “Add action” in the event:
There is a misunderstanding. It was my fault that I did not specify correctly. I mean the parts marked with a green line.
Hi, this is made, I think, to avoid shooting 60 bullets per second when pressing space.
With this timer, bullets are separated from each other by 0.3 seconds.
If this timer were not here, it would send a bullet at every frame, so might be 60 times per second.
The game code is read around 60 times a second, if it runs at 60 fps (frame per second).
Is the name “Fire begin” an optional name or timer?
According to what I see, it’s only the name of the timer, chosen in this example.
The name could be anything, what’s matter is that it’s the same timer (same timer name) in condition and action :))
Please consider my code:
When I add the timer, the player stops shooting!!
And when I remove it, it starts shooting again!!
Ah ! I think it’s because the timer has never been started.
Because the character shoots only if space pressed and timer >0.3 sec.
But if the timer has never been started, the timer is at 0.
At the beginning of the scene, for example, you’d need to start this timer, just to make surethe first time the player presses space, the timer is >0.3.
After this first shoot, the mechanic will work fine : each shoot bring back timer to 0 and character needs to wait 0.3 sec. to shoot again.
Do you think that’s the reason? If timer has never been started it must be that.
Thanks now I will test it.
Excellent! you are right.
I added this code:
And now it works well.