playMaker

Author Topic: Rotate - How to Stop  (Read 2718 times)

richard216

  • Playmaker Newbie
  • *
  • Posts: 3
Rotate - How to Stop
« on: April 12, 2016, 07:19:05 PM »
Newb question:

A have a global bool that controls when I want to start and stop the rotation of a cube.  Listening for the bool to change, I then check the bool and then either tell it to Rotate 10 degress per second, every frame; OR it should set the rotate value to 0 and Per Second or EveryFrame is checked off (to stop it.)

Question - I notice when I fire off the Rotate action, I don't know how (or if I can) Finish off the state.  I want it to start the Rotate action, and then continue back the the listen for Bool Change.  Right now it just sits at Rotate, stopping the whole FSM.

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Rotate - How to Stop
« Reply #1 on: April 13, 2016, 03:40:57 AM »
Hey dude,

Rather than type out the answer I made a video to show you:

https://youtu.be/ziV0B5yXK7E

There are lots of ways to use playmaker but this should hopefully work for you.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: Rotate - How to Stop
« Reply #2 on: April 13, 2016, 08:51:55 AM »
It's a bit weird... that thing you did. The state finishes and it goes to itself. I havn't seen this before. Why did you do it like this? Isn't it a problem?
Technical Game Designer
www.GamerPET.com

richard216

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Rotate - How to Stop
« Reply #3 on: April 13, 2016, 11:44:10 AM »
Thanks for the vid.  Will try out your solution in a bit.  Cheers!

joduffy

  • Full Member
  • ***
  • Posts: 121
  • Here to help
    • Online Playmaker Courses
Re: Rotate - How to Stop
« Reply #4 on: April 13, 2016, 05:18:31 PM »
No worries richard216. Hope it helps you out.

PET, I wasn't sure if you meant the video I made or richard216 screenshot. But in the video I have a FSM that loops back on itself. It's similar to an update or loop.

It's just one of the tricks or ways I create an FSM. It's not a problem as long as you aren't looping 1000 times within less than a second. But as the state only updates every second its not a problem.

I guess the better way would be to automatically update within the same state. But this can be handy if you are using actions that don't have that option.

I sometimes create a mini loop with a few states for checking variables. So if the variables or conditions of my game aren't what I need for the loop to end, I go back into the loop and check again until they are.

You can always make custom actions as well to keep the FSM's clean.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith