[Solved] Need help to understand this issue in this tutorial

Hi,

In this gdevelop tutorial:
https://wiki.gdevelop.io/gdevelop5/tutorials/space-shooter/10-sound-effects-music

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.


Thanks,

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:

1 Like

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).

1 Like

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 :))

1 Like

Please consider my code:

When I add the timer, the player stops shooting!!
And when I remove it, it starts shooting again!!

Why?

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.

1 Like