How do I Slding Shoot / Delay each Shoot

Get help using Construct 2

Post » Fri Apr 28, 2017 10:27 am

Message: jpstudio can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello,
I have a little problem that I can not solve.
I made a system bow and arrow with limits between 0 and 20º
But when I shoot or tap the screen to shoot again without waiting for the previous arrow be destroyed or leave the screen, and try shoot again the bow pulls the arrow back to the bow instead of creating or spawning a new one,I need a delay of 0.5 seconds with each shot too '-'
Can someone help me please?
Thx <3


http://bit.ly/2pFCvS8
B
6
S
1
Posts: 31
Reputation: 414

Post » Fri Apr 28, 2017 1:07 pm

Are you using the object spawn other object event? I am at work so can't download capx right now.

The second part is easy fix. Just make a variable to control when a shot is allowed. Put an instance variable on bow called hasShot=0 and in your touch-shoot event add condition hasShot=0. At very top of shooting actions put set hasShot=1. Now at the bottom of your shoot event actions add your wait 0.5 followed by set hasShot=0.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Fri Apr 28, 2017 1:11 pm

use every X seconds
or
make a helper variable set on each shot and decrease it permanent with factor timescale if it's>0, check before each shot on helper var <=0.
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221

Post » Fri Apr 28, 2017 1:48 pm

The delay is okay. THX <3
My biggest problem is with the bow, when I touch the screen he pulls the arrow that has already been thrown and creates another arrow so he gets 2 arrows in the bow 1 true and 1 with a bug.

:(
B
6
S
1
Posts: 31
Reputation: 414

Post » Fri Apr 28, 2017 6:14 pm

up
B
6
S
1
Posts: 31
Reputation: 414

Post » Fri Apr 28, 2017 6:21 pm

Add a condition that checks the State of the arrow, or a variable that keeps track of it.

For example, add an "IsFlying" boolean instance variable. When you shoot your arrow, set IsFlying to true. In your firing event, check to make sure Arrow.IsFlying is false.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Fri Apr 28, 2017 6:34 pm

oosyrag wrote:Add a condition that checks the State of the arrow, or a variable that keeps track of it.

For example, add an "IsFlying" boolean instance variable. When you shoot your arrow, set IsFlying to true. In your firing event, check to make sure Arrow.IsFlying is false.



Could you do that in my .capx that is here in the forum? please
I tried to do something like this and I could not
B
6
S
1
Posts: 31
Reputation: 414

Post » Fri Apr 28, 2017 10:08 pm

up
B
6
S
1
Posts: 31
Reputation: 414

Post » Sat Apr 29, 2017 1:47 am

up
B
6
S
1
Posts: 31
Reputation: 414

Post » Sat Apr 29, 2017 2:39 pm

What oosray is saying is to use a varible exactly like you might have used to solve the firing delay:

Just make a variable to control when an arrow is allowed. Put an instance variable on bow called inFlight=0 and in your touch-shoot event add condition inFlight=0. At very top of shooting actions put set inFlight=1. Now at the bottom of your shoot event actions add a wait 0.5 followed by set inFlight=0.

You could just use one variable for both of your problems if you only wanted an arrow to be loaded and fired every 0.5 seconds. You would simply need to condition out that variable in your firing event code.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Next

Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 14 guests