0 Favourites

How do I Slding Shoot / Delay each Shoot

  • 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

    bit.ly/2pFCvS8

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • Hey

    I need to make the model physic catapult create a delay of 1 second with each shot.

    Example:

    I would shoot the first pig after it would create a new pig and would release a new shot after 1 second.

    you can help me? please

  • I am not familiar with the "model physic catapult". Is this one of the templates that come with C2?

    If not can you provide an example?

  • I

    Is this same, C2 physic catapult.

    I need it to stay in an angle of 0 to 20 degrees and have a delay in every shot of 1 second.

    But I can not do it, I've been trying for 14 days and I can not do it.

    do you can help me? please

  • The delay is easy, just put wait =1 and isAiming=1 at bottom of the "on any touch end" event.

    I am terrible at calculating angle logic (and am minutes from heading to Disney World) but you will need to change the values in the "is in touch" event (angle(Touch.X, Touch.Y, CatapultBlock.X, CatapultBlock.Y)) to restrict the draw to your required angle... maybe someone with a better head for that can give you the correct values. You might want to ask just that part of of your question in the forums again "Correct logic to limit physic catapult to 0-20 degree firing angle".

    If you need to reset the camera back to the catapult after it scrolls to the shot pig you can use a subevent under the "Else" portion of the "Is aiming" event that uses event "Is Physics sleeping" with action scroll to catapult.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)