playMaker

Author Topic: Cubes as health  (Read 1281 times)

ArctheLad

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Cubes as health
« on: September 02, 2013, 03:34:05 AM »
Hi forum,
I have a query that I was wondering whether people could give me a hand with.

I have 10 cubes that are set in the corner of the screen to give a health bar. As the player encounters something negative the trigger will send a global event to the manage for the health cubes that then does the following logic.

Idle State (Handles receiving the sent event) > Blink the cube and wait for 0.7 seconds > Deactivate the blinking cube (I went for deactivate to work in the health system to bring them back.

What I want the manager to do is to then get the next cube, so the 9th cube along and run it through the same logic. I can do it by repeating the logic 9 more times, I'm just wondering if there is an easier way using managers, much like the number based health system in the Youtube tutorial.

ArctheLad

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Re: Cubes as health (Update)
« Reply #1 on: September 02, 2013, 03:59:39 AM »
To update,

I have found an action called 'Get next child' that I can now put my life bar cubes into so it now runs through the manager and applies logic to it. However, once the last cube cube deactivates the game is still running. Is there any way to get the logic to fire an event when the last cube disappears?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14595
  • Official Playmaker Support
    • View Profile
Re: Cubes as health
« Reply #2 on: September 10, 2013, 03:05:34 AM »
Hi,

 you'll have to wire the logic yourself, here. For example, when the loop if finished you can go to another state that will implement the logic needed ( to fire an event on the last cube).

 Unless, I misunderstand and you want to actually watch cubes disappearance only? for this you don't need to iterate throught each cubes, simply maintain a variable representing the number of cubes, and everytime a cube appear or disapear you increment decrement that integer, when this integer it 0, then it means all cubes are invisible, hence the end of your game.

bye,

 Jean