playMaker

Author Topic: Change of scene on inactive mouse  (Read 326 times)

FunD

  • Playmaker Newbie
  • *
  • Posts: 29
    • View Profile
Change of scene on inactive mouse
« on: May 31, 2019, 07:13:12 AM »
Hello,

I was wondering if and how I could set this up with Playmaker. I would like that after a given time of the mouse being inactive, it loads the title screen scene.

Any advice on how to achieve this?
Thanks

daniellogin

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Change of scene on inactive mouse
« Reply #1 on: June 04, 2019, 02:21:06 AM »
How about something like this;

* First state has a Wait (the maximum time out) which sends an event another state (State 2) to do the scene change or what ever

* First state is also watching for mouse input vectors. When any vector is detected, it goes to State 3. You may want more instructions if you aren't used to getting these kind of inputs, but basically just record the vectors, maybe as a float for each direction, then do a Float Compare every frame where more or less than 0 sends the event to go to State 2.

* State 3 is just to interrupt the Wait in State 1. You could just have it Finish and go straight back to State 1... Only that won't work properly  ;)   That could potentially create an error where it loops too many times and pauses the FSM. So OK, what you can do instead is use another quick wait. 1 second or what ever. Just enough so it won't trip the "infinite loop detector" (I don't know what it's called, but stops it circling infinitely each tick) but not enough to through the actual time out Wait too much for your liking.

Every time it goes back to State 1, the timer (Wait) there will restart again.
« Last Edit: June 04, 2019, 02:23:39 AM by daniellogin »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4691
    • View Profile
    • jinxtergames
Re: Change of scene on inactive mouse
« Reply #2 on: June 09, 2019, 02:14:09 AM »
Hi.
To avoid getting a loop error you can also use a next frame event in between instead of a wait :)

TO detect you can use :

'Get Mouse X' and 'Get Mouse Y' (store both values)
Then use 'Float changed' on X and Y

Set "Changed event" to next state, in next state place 'Next Frame Event' and loop back to previous state.

daniellogin

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Re: Change of scene on inactive mouse
« Reply #3 on: June 10, 2019, 02:02:51 AM »
Hi.
To avoid getting a loop error you can also use a next frame event in between instead of a wait :)

TO detect you can use :

'Get Mouse X' and 'Get Mouse Y' (store both values)
Then use 'Float changed' on X and Y

Set "Changed event" to next state, in next state place 'Next Frame Event' and loop back to previous state.
I try to lend a hand to un-replied threads, but a lot of the time I end up learning myself  ;D

I never noticed a 'float changed' action before. Also didn't know about 'next frame event' either, and so will actually start using that too.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4691
    • View Profile
    • jinxtergames
Re: Change of scene on inactive mouse
« Reply #4 on: June 10, 2019, 03:04:56 AM »
Hi.
I learned a lot helping others on the forum and still learn sometimes something new :)

Next Frame Event can be used in many cases.