Power Bar

GxRain360GxRain360 Member Posts: 7

Ok so i am making a dragon ball z game where i will have a power bar and health bar. I already have the health bar working fine... The game ends when it does but i want to stop the button that does the power moves from working when the power bar drains. Is this at all possible?

Comments

  • GxRain360GxRain360 Member Posts: 7

    Oh and i have a button that restore the power bar but i have trouble constraing it. When i power up i end up with too much that it goes off the screen

  • FINNBOGGFINNBOGG Member Posts: 1,810
    edited November 2015

    Make a boolean or index attribute. Call it Poweryesno or something like that.

    If your powerbar is greater than 0 then make poweryesno true. if powerbar is 0 or less than 0. make poweryesno false.

    Now in your action button rules. simply add if pressed and if poweryesno is true. do action

    that way the button is checking 2 rules. 1 if touched and 2 if poweryesno is true.

    Your action Buttons are looking at the powerbar to see if its allowed to do anything.

    I hope that helps.

    If you want there the hero to need a certain amount of power to do a task. then change the rules to something other than 0. He may need 20power to do this task and 40 power to that task. The button needs to check and see how much power is available.

  • GxRain360GxRain360 Member Posts: 7

    Thanks for replying. So i made a boolean called powerOnOFF, i then made a rule -did attribute- game.Power less than or equal to 0. And im kinda stuck

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,914
    edited November 2015

    All you need to do to lock out the button is to lock it out based on the minimum power needed to execute the power move. So let's say you need aleast 20 to execute a power move, in your button rule add the game level attribute where you store the power value.

    Rule for button

    When touch is pressed
    When attribute game.power => 20

    As for the power bar going off screen this video will help.

  • GxRain360GxRain360 Member Posts: 7
    edited November 2015

    Ok thanks lost Oasis i got it to work, when the power bar runs out i cant fire until i power up but it leaves another problem. When i power up there is no limit so the actor ends up with too much power if i hold on to the button, iv seen some stuff online but none of them seem to work... so my power bar is at 20 integer then in the power bar i have self.size.width to game.power*20

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,914

    In your code that adds the power put a limit on it. I'd need to know the code for how you add power.

  • GxRain360GxRain360 Member Posts: 7

    Is there a way to show you screenshot?

  • GxRain360GxRain360 Member Posts: 7

    Ok on the actor i did key S with the animation and under the power bar i have a rule for the S button with a timer for ever 0.5 seconds S is bend held then under timer i added change attribute - game.power to gane.power+2, then another rule for when the power buttons are pessed game.power-1

  • GxRain360GxRain360 Member Posts: 7

    I got it done 100% thank you both for your assistance

Sign In or Register to comment.