How do I make a self-depleting bar?

  • I don't know what term it should be called, so I'll just call it that. You know those games where you have to keep pressing a certain key (usually clicking) to get the bar to full, but the bar would keep depleting itself automatically so you would have to click faster? A struggle bar, so to speak.

    Here's the description: Beam Struggle – If two special attacks collide with one another, the Player must repeatedly press [Spacebar] to win against the enemy’s attack. If they fail, they lose one life.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What's the bar tied to? A variable?

    Can't you just have an event that substracts from it every 0.5 or so second (using the Timer behavior) and a "On key pressed" event that adds a little to it?

    Maybe I didn't understand exactly, but it doesn't sound too complicated to do.

  • Hello Enoba,

    you can use a ProgressBar or, for your specific intent, a TiledBackground like in the screenshot. I also added the 'SetColor' effect to the tbg, so it goes from green to red the more the bare "is filled".

    You can change the formula in the 'Every X seconds' to achieve better results.

    I can not say whether the SetColor effect is the same in C2. You may seperate between parameter 0, 1 and 2.

  • Thank you all so much! It works now!

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