playMaker

Author Topic: Event not send every frame  (Read 2525 times)

ryf9059

  • Full Member
  • ***
  • Posts: 100
Event not send every frame
« on: June 18, 2013, 10:54:01 AM »
I have fsm that sends a event every frame when it's in that state. But when running, the event it sent only once. In the picture you can see it doesn't have the green checkbox.



I use it to control movement and now I have the problem of player not being able to move after jumping because the event is not sent every frame and the fsm that controls movement cannot receive it and therefore stuck the player.

Any ideas?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Event not send every frame
« Reply #1 on: June 19, 2013, 01:31:56 AM »
Hi,

 I think you should have two Fsm, one that check for mobile right and left and fire global events, and a second that simply listen to these global events, so that it can perform other operation without having to worry about checking for mobile left and right itself.

 does that make sense?

bye,

 Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: Event not send every frame
« Reply #2 on: June 19, 2013, 05:00:40 AM »
I think you should have two Fsm, one that check for mobile right and left and fire global events, and a second that simply listen to these global events, so that it can perform other operation without having to worry about checking for mobile left and right itself.

 does that make sense?

Yes and this is actually what I do, in the picture the fsm is for sending events only, and I have another FSM listen to those event and perform corresponding action. My problem here is that the fsm doesn't fire global event when it should be, as you can see, it doesn't send the event every frame. So the other one that listens to the events cannot catch it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Event not send every frame
« Reply #3 on: June 19, 2013, 05:47:09 AM »
Hi,

 Doing with two fsm should get rid of the need to fire events every frame. This is something I never do actually.

 not trying to get away from the problem, but this is not really a good practive in my opinion to send events every frame, instead prefer sending two events, one when the behavior starts and one when it ends ( what ever it is). to take a generic example, draggin should not fire an event every frame, instead it should fire an event when dragging starts and en event when dragging ends, this is much much better and clean. any fsm interested in dragging simply implement these two events and done, they can do very complex fsm in peace without getting constantly that dragging event which likely breaks asynchronous fsm logic, like in your case.


bye,

 Jean