Ignore key held down when ammo runs out?

0 favourites
  • 2 posts
From the Asset Store
Run Vovan Run
$1.60 USD
60% off
Full game Construct 2 and Construct 3 to post on Google Play
  • Hi all, I'm going around in circles with this!

    I've got a machine gun that should fire 50rounds a second with the following code and Global variable mgun.

    + Keyboard: Space is down

    + System: position = 3

    + System: mgun ≥ 0

    -> huey: Spawn bulletleft on layer 2 (image point "gunsleft")

    -> bulletleft: Set Bullet angle of motion to huey.Angle-180 degrees

    -> bulletleft: Set Bullet Enabled

    ----+ System: Every 1.0 seconds

    -----> System: Subtract 50 from mgun

    ----+ System: Trigger once

    -----> Audio: Play guns.webm looping at volume -5 dB (tag "guns")

    When the mgun Global variable is = to 0 and the spacebar is still down the guns still fire, if the spacebar is released then pressed again it won't fire.

    I've tried setting an every tick check putting the above in a group and when the mgun variable is = to 0 then set group to disabled but still the same, hopefully this makes sense, just can't think how else to get it to work.

    Thanks for any help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because youve put greater or equal to 0 so when it's equal to 0 the guns will still fire until you subtract 50 again and bring it below 0.

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