About Bullets!

Get help using Construct 2

Post » Thu Sep 26, 2013 1:20 pm

So Constructers what is the best way to do these,I tried but they are not working the way I want:

1- I want the character to wait like 2 seconds before it's able to shoot again.

2- is there any way around to make yor bullet draw a line behind it wherever it goes before it hits the target and fades away? Like a path tracing more or less.


B
13
S
4
G
4
Posts: 42
Reputation: 3,962

Post » Thu Sep 26, 2013 1:29 pm

both are possible.

B
18
S
6
G
3
Posts: 197
Reputation: 4,129

Post » Thu Sep 26, 2013 1:50 pm

@fawdda

1 - Add a cooldown to your fire action. Something like :
Var Cooldown = 0;
On fire event (if Cooldown <= 0) Fire bullet; Set Cooldown to 2;

Every tick (if cooldown > 0) substract dt (delta time) from cooldown.

2 - You can create a sprite behind your bullet at every tick. And destroy this sprite after few secs.

B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Thu Sep 26, 2013 2:36 pm

Check out this tutorial by Ashley, he explain of to do this kind of thing using the Wait and Every N second conditions
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Sep 26, 2013 3:22 pm

@joskin @olivierc thanks a lot I'll give it a try.
B
13
S
4
G
4
Posts: 42
Reputation: 3,962

Post » Thu Sep 26, 2013 3:24 pm

here a capx
B
18
S
6
G
3
Posts: 197
Reputation: 4,129

Post » Thu Sep 26, 2013 3:35 pm

[QUOTE=Joskin] @fawdda

1 - Add a cooldown to your fire action. Something like :
Var Cooldown = 0;
On fire event (if Cooldown <= 0) Fire bullet; Set Cooldown to 2;

Every tick (if cooldown > 0) substract dt (delta time) from cooldown.

2 - You can create a sprite behind your bullet at every tick. And destroy this sprite after few secs.

[/QUOTE]

I'm curious about this approach versus using a timer. It basically does the same thing (I beleive), doesn't it? I have an InstanceVar on the player, canShoot set to true. Then when the player shoots, the instancevar gets set to false, and I set a unique timer. When the timer event fires, I set the instancevar back to true. I know the dt is the real time in seconds, whereas the timer would be affected by the fps the game was currently ruuning at. Is this correct? Is the approach you outline here more efficient and optimized than a timer approach that I'm currently using?
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Fri Sep 27, 2013 9:03 am

@yonda thanks a lot for the capx file.

I like the trail fx but when I boosted up the bullet speed it's become into pieces, showing the fact that it's just a rectangle sprite.

I actually want to achieve your effect but with sequential trial that follows the bullet no matter where it goes.
B
13
S
4
G
4
Posts: 42
Reputation: 3,962

Post » Fri Sep 27, 2013 10:29 am

you could use an effect
B
18
S
6
G
3
Posts: 197
Reputation: 4,129


Return to How do I....?

Who is online

Users browsing this forum: AndreasR, David181, karthikavnair and 8 guests