How do I make bullets shoot vertical?

Get help using Construct 2

Post » Wed Mar 21, 2012 8:48 pm

So I am making a vertical shooter game. How do i make my bullets shoot upwards instead of sideways? Right now when they shoot the fly to the right. Thanks in advance!mitchjohnson522012-03-21 20:48:22
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Wed Mar 21, 2012 8:50 pm

And one more question, I am trying to have it when you hold the left mouse button the bullets shoot automatically. Is there a way to change the rate of spawning?? I have set up a custom movement so that the player airplane moves towards where the mouse is clicked, but I need the bullets shooting at a lower rate
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Wed Mar 21, 2012 9:01 pm

You can set the bullets angle when it's created to make it fly up instead

As for rate of fire, make a variable for reload and set it to 0

In the event where you fire a bullet make a subevent that says if reload=0
so it will only fire if it's 0
In the same event set reload to something above 0 once the bullet is fired

Finally make an every tick event and set reload to subtract 1 if it's above 0

Hope it makes sense:)
B
13
S
2
G
1
Posts: 85
Reputation: 1,502

Post » Wed Mar 21, 2012 9:04 pm

ok the reload makes sense, but how do I set the bullets angle when its created? Thanks :)
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Wed Mar 21, 2012 9:05 pm

nevermind I found it :) thanks again!
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Wed Mar 21, 2012 9:12 pm

np:)
B
13
S
2
G
1
Posts: 85
Reputation: 1,502

Post » Wed Mar 21, 2012 9:14 pm

Ive got the bullets firing upwards, so now i just need to get the reload time down. I made the variable on the bullet and named it Reload. I made the subevent and made reload=0. Now what do I do for a moderate fire rate?
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Wed Mar 21, 2012 9:25 pm

Try setting reload to 30 when you fire the bullet and go from there
B
13
S
2
G
1
Posts: 85
Reputation: 1,502

Post » Wed Mar 21, 2012 10:31 pm

You're going to want to use dt (delta time) for your reloading events.
Here's a simple way to go about it;

Every tick
   add dt to reload

Reload = 1
   plane shoot bullet
   set reload to 0


With this, you'll shoot every 1 second. You can change it to 1.5,
and then you can shoot every second and a half.

You can read more on deltatime here.Intrepid2012-03-21 22:32:07
B
12
S
2
G
4
Posts: 44
Reputation: 2,389

Post » Wed Mar 21, 2012 11:27 pm

EDIT: Looks like you deleted your post. I'll leave the next part be.

Also, you'll want to check if reload is equal or greater than what you want.
I typed it out kinda fast, and missed that. If you didn't do that, then
dt might add an odd number to reload, and you'd get 1.03 or something,
and the condition would never trigger.Intrepid2012-03-21 23:29:30
B
12
S
2
G
4
Posts: 44
Reputation: 2,389

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Calfuso, totoe, Yahoo [Bot] and 20 guests