Page 1 of 1

Why it waits for 0.5 to fire, the very time I press the key?

PostPosted: Fri 3 Aug 2018, 15:58
by Umar
I have set the event such that if I press the key it will fire the bullet just once but only if the timer is greater than 0.5 sec. But why when I press the key for the first time it waits for 0.5 second and then fires? In the first turn it should fire immediately fire and from there it should fire after timer fire > 0.5 sec.

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Fri 3 Aug 2018, 19:29
by ddabrahim
why when I press the key for the first time it waits for 0.5 second and then fires?

Because the timer has been not initialized until you press the key and the condition being triggered for the first time.
Start the timer at the beginning of the scene.

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Sat 4 Aug 2018, 04:12
by Umar
What do I do? what is the solution?

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Sat 4 Aug 2018, 11:26
by ddabrahim
Umar wrote:What do I do? what is the solution?

ddabrahim wrote:Start the timer at the beginning of the scene.

The event is actually called Unpause timer. When you Unpause the timer at the beginning, the timer will be initialized at the beginning and start counting. By the time you press the button, the timer will be >= 0.5 and you be able to shoot a bullet immediately at the beginning of the game.

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Sat 4 Aug 2018, 14:22
by ddabrahim
I have updated the shoot-bullets examples, you can download it from here:
https://gametemplates.itch.io/gdevelop-examples

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Sat 4 Aug 2018, 15:27
by Umar
Thanks!

Re: Why it waits for 0.5 to fire, the very time I press the

PostPosted: Thu 9 Aug 2018, 05:00
by adrian121
I wish I saw this post sooner