playMaker

Author Topic: stainmina bar problem  (Read 1570 times)

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
stainmina bar problem
« on: June 18, 2018, 11:13:08 PM »
Hi All,

I've posted a stainmina bar question days ago, and now I have more problem about it...
The effect I want to create is for the player to be able to attack the enemy when the there is energy. As the player attacks the enemies, his energy bar will decrease.
When the energy bar decreases to 0, the attack FSM will be inactivated, so he won't be able to attack. Meanwhile the energy bar will grow back up.
Now the energy bar will only start to grow when the scale is equal to 0. But what I want is for it to grow whenever the player is not attacking.
Does anyone have any idea how I could make it happen?

Thanks,
M

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: stainmina bar problem
« Reply #1 on: June 18, 2018, 11:49:11 PM »
I don't know about how you have it set up or any other posts you have, but what about a separate FSM to grow the stamina? Have it simply doing a check to see if attacking is happening and then add then loop back to checking again. So then in your attacking you will have a 'switch' tick on while the attack is in motion then tick off when the attack is complete.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: stainmina bar problem
« Reply #2 on: June 19, 2018, 08:14:11 AM »
Hi.
A separate fsm would be needed indeed.

Have 2 states one for idle(do nothing) and one for adding energy.

On both state have a Bool Test and test every frame. (name the variable to test 'Add Stamina' for example.

On the idle state 'if true' send event to adding energy state.
On the adding energy state 'if false' send event to to idle state.

In the adding energy state use add float and set every frame and per second to 'grow' the stamina.

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: stainmina bar problem
« Reply #3 on: June 20, 2018, 11:09:08 PM »
Thanks guys,

I'll try to separate the FSM and see how it goes.

Cheers,
M