Restricting one instance of a sprite on screen not working

  • I'm trying to make it where when a sprite is spawned, only that one version of the sprite can be on-screen until it is destroyed. Kind of like having a missile, but prevents the player from spamming missiles and only allows for one missile to be on-screen at once.

    In this instance I'm specifically attempting making the sprite appear when the button is held down, and vanish when the button is released.

    This is my attempt:

    I figured just make a check to only allow a button press when the sprite is off-screen, but oddly that didn't work. Then I tried to make an instance variable that would boolean a value to to true when created, and also would only allow a spawning if the boolean was false. Also didn't work. After the same failure occurred after a number variable, it became clear to me that there is something that I'm just not doing right.

  • At a quick look, make spawned a global variable. And put 84 a subevent of 85 (reverse them) and obviously move the actions to 84.

  • Simply put sprite.count then restrict them:

    Just change the keyboard setup with gamepad setup.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's exactly what I needed! Thanks!

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