How do I Change fire rate of bullets

Get help using Construct 2

Post » Tue May 05, 2015 5:32 pm

Sorry, im a bit newbie and i just came out of the first beginner tutorial.
And my question is to how to change the fire rate of the bullet spawn.

So that they For example, shot one, and than wait 1 sec, and than shot 1 and wait 1 sec etc. etc.

It didnt worked the way i did haha. :lol:

Image

Thanks, i would apreciate if you try to be a bit precise on how to do it.

Thank you :D
B
5
S
1
Posts: 10
Reputation: 406

Post » Tue May 05, 2015 6:12 pm

What you are currently doing is, when the mouse is clicked, wait 1 second and fire the bullet.

What I think you want to be doing is, every X seconds, is left mouse button down -> fire bullet.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Tue May 05, 2015 7:00 pm

briggybros wrote:What you are currently doing is, when the mouse is clicked, wait 1 second and fire the bullet.

What I think you want to be doing is, every X seconds, is left mouse button down -> fire bullet.


¿How would be going that event you say?
B
5
S
1
Posts: 10
Reputation: 406

Post » Tue May 05, 2015 7:27 pm

Hi,

You can add boolean var to Jugador (Asreload= true (default))

condition: on mouse leftclick AND Jugador Asreload=true
action : set Jugador boolean var = false
Jugador spawn bullet
wait "reloadtime" (variable,1sec,10sec what you want...)
set jugador bolean var= true

well done ;)

EDIT: you can change condition "on left click" by "on left mouse down"
Last edited by MadSpy on Tue May 05, 2015 7:32 pm, edited 1 time in total.
Image Image
B
25
S
14
G
137
Posts: 876
Reputation: 71,510

Post » Tue May 05, 2015 7:29 pm

So create an event using the "every X seconds" event. Then add a condition of "mouse button is down", and then use the same action for firing.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Wed May 06, 2015 2:58 am

briggybros wrote:So create an event using the "every X seconds" event. Then add a condition of "mouse button is down", and then use the same action for firing.


Sorry for disturbing you bro but i cant find "Every X Seconds" in the event/action area.
¿Shall i create a new object for that? Or could you send me a screen shot on how the formula is?
Thanks :)
B
5
S
1
Posts: 10
Reputation: 406

Post » Wed May 06, 2015 5:59 am

every x second is under system events.. the cog wheel icon. It has to be a primary or secondary event, you won't find it under actions or not primary/secondary events.

I think from your post what your actually wanting is for the player to fire a single bullet by clicking and have to reclick for each shot... however you don't want them to be able to do it quicker than once per second... ?

If that is the case you will want to use a Boolean instance variable on your player, lets call it "hasFired=false". Now move your current Wait-1 to beneath the fire bullet action and add an action "hasFired=true" before it and a hasFired=false after the Wait.
On mouse click fire bullet
hasFired=true
Wait 1 second
hasFired=false

Add a second condition to Mouse click fire bullet (right click on,above or below the little green arrow on left side of condition space and select add-new condition)
that condition will be hasFired=false.

Now when the game starts the player can shoot by pressing mouse button because "hasFired" is false by default but once they click button and fire a bullet the flag hasFired will show true and clicking will not do anything but once a second passes it will work again because hasFired will again be false.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Wed May 06, 2015 9:40 pm

If you want the mouse to be held down then you would imput
Mouse: Mousebutton (Left) is down
System: Every (0.25) Seconds
Jugador: Create object Bullet Layer 1 Image point 1 (Both system and jugador in same action sequence)
That should work
B
5
S
1
Posts: 6
Reputation: 412

Post » Thu May 07, 2015 10:10 am

Hey everybody I'm having the same problem with the bullets I followed step by step what @chrisinfinger wrote but I'm having difficulties finding this :

Add a second condition to Mouse click fire bullet (right click on, above or below the little green arrow on left side of condition space and select add-new condition)
that condition will be hasFired=false.

Is it me or there is something wrong?
B
8
S
3
Posts: 120
Reputation: 989

Post » Thu May 07, 2015 3:49 pm

ImageImageImage
B
71
S
22
G
242
Posts: 3,734
Reputation: 134,994

Next

Return to How do I....?

Who is online

Users browsing this forum: dand, mickclarke and 27 guests