playMaker

Author Topic: Recursion...or moving objects  (Read 1827 times)

cdutoit

  • Playmaker Newbie
  • *
  • Posts: 28
Recursion...or moving objects
« on: August 29, 2013, 01:53:06 PM »
Hi -

Does Playmaker support recursion within a FSM? That is, if I have a FSM that starts on an event, and if inside that FSM I fire the event, will it start another invocation and will it be truly recursive, such that as they complete, they pop back up the stack so to speak?

The reason for asking is I'm developing a match-3 style game. When a column has empty places in it, I have to move all the items down to fill the empty spots. From a code perspective, this is elegantly accomplished with a recursive method call, and I want to see if this same approach could be used in Playmaker?

Thanks for any suggestions,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Recursion...or moving objects
« Reply #1 on: September 10, 2013, 03:27:36 AM »
Hi,

 yes, it will recurse, BUT events to not bubble up, that is, you can't send information back to the original sender, without actually storing the reference of the event sender at every level.

 Bye,

 Jean

Farad77

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Recursion...or moving objects
« Reply #2 on: September 23, 2013, 10:53:26 AM »
Hi i'm just trying a simple example of recursion using RunFsm and template and it's not going quite well:
I've got a fsm running a template using RunFsm with a int variable (ex:10).

The template itself test the int variable, if <10 RunFsm the same template passing int-1 else  FinishFsm action .
This example simply lock out my Unity, i must kill unity.exe.
I tried in the host fsm running the template with int=0, everything works well, it's really the runfsm in the template that isn't working.

What did i missed here?
I'm using Unity 4.2.0 with playmaker 1.7.4f3