How do I make a bar that slowly fills up?

0 favourites
  • 11 posts
From the Asset Store
An educational game for Fill in the Blanks. An easy to use template for developers to build larger games
  • I'm making a top down shooter, and attached an area-of-effect attack to the RMB. However, it is spammable by clicking rapidly.

    I want to have a progress bar slowly fill up, and when it's full make the attack available. When the attack is used, the bar resets, and starts regenerating.

    How do I do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would make that in this way:

    Flashing is just to see if it works

  • Can you explain how this works? What is weapon_cooldown?

  • Okay the first part is

    When the mouse is clicked it checks if the recharge is done. If so it that triggers the flash and subtract the recharge by 20 making it 0 again ( i would change it to set )

    Line 2 is basicly every 0.25 secounds if the recharge is less then 20(not done) then it adds 1 to the recharge.

    Line 3 is displaying the recharge.

    Thanks to Bburg800 for the capx example. Any question feel free to contact me.

  • you will need Rex cooldown plugins for this

  • Thanks I got it working, but there are still some bugs

    The bar only fills up halfway before stopping, and I can still fire as many times as I want

    Edit: Nvm about the bar filling up, but I can still fire as many times as I want. I want it so you can only shoot once, when the bar is full.

  • Then add a check at your firing code, if you should already be able to shoot

    • as soon as the bar is full, set a boolean instance variable (for example: Bar_full set true)
    • if the bar is empty, set this boolean variable to false

    and then add in your firing code another AND check.

    If Bar_full set true

    - you can shoot

  • What do you mean by check?

  • a simple and event

    an and event is just a normal "add" event. that's it.

    it would be easier to help you if you could include your .capx file.

  • Everytime I try to add it as an attachment, the page refreshes and it never uploads. Ill try to do it through google docs just pm me your email

  • I solved it! What I did was set the conditions for fire to be true when the bar was =50

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