After you Shoot,you get a Cooldown.

0 favourites
  • 5 posts
  • Hello,

    I want to make that if i Shoot with Left Mouse. After that you can't Shoot for some Seconds. I tried this. Mouse/Left Mouse pressed = Spawn a Bullet and than Wait. But it don't work with Wait. How i can solve that ?

  • You can create a variable, for example "Shot" and make it so you can only shoot if this variable value is zero, so, when you shoot set the value to 1, and after X seconds set its value to 0 again.

  • I would use a boolean and set it to true. When you shoot with the left mouse button, set that bool variable to false. That way, no matter how often someone clicks that left button it won't shoot. Then, after the Wait period you've set is up, set the bool variable back to true. Now they're able to shoot again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to make a distinction between Conditions and action.

    The cooldown is part of the condition not an action, so you should not use the Wait action.

    There are 2 ways to make the cooldown.

    First method is using instance variable.

    Add Instance Variable to the player, lets call it PlayerCooldown. Its value should be zero on default.

    The player can shoot if the PlayerCooldown < 0 and lmb is pressed.

    When he shoot, the PlayerCooldown value will be set to Value X (in seconds)

    Make another event that will reduce the PlayerCooldown value to zero. An event condition like Every X seconds can do the job, Make it so Every X seconds, X value of PLayercooldown will be substracted.

    Method 2, make use of an add-on created by rexrainbow

  • I would use a boolean and set it to true. When you shoot with the left mouse button, set that bool variable to false. That way, no matter how often someone clicks that left button it won't shoot. Then, after the Wait period you've set is up, set the bool variable back to true. Now they're able to shoot again.

    Wow thank you very much

    And again the Solution was Boolean,i never think about it ...

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