Ignore key held down when ammo runs out?

0 favourites
  • 2 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • 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 2 visitors browsing this topic (0 users and 2 guests)