How do I make a self-depleting bar?

Get help using Construct 2

Post » Tue Feb 13, 2018 12:39 pm

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.
Posts: 2
Reputation: 229

Post » Tue Feb 13, 2018 1:41 pm

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.
Posts: 41
Reputation: 917

Post » Tue Feb 13, 2018 2:35 pm

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.
Posts: 81
Reputation: 1,445

Post » Sat Feb 17, 2018 2:18 am

Thank you all so much! It works now!
Posts: 2
Reputation: 229

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests