Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: kenmarold on August 05, 2015, 11:23:29 PM

Title: Restart game after after 2 minutes of inactivity
Post by: kenmarold on August 05, 2015, 11:23:29 PM
I'm trying to figure out how to begin writing a piece of code that listens for user activity. If there is absolutely no activity after a few minutes I want the game to restart. Can someone recommend a good starting point to get something like this working?
Title: Re: Restart game after after 2 minutes of inactivity
Post by: Kombiice on August 06, 2015, 02:39:59 AM
You cloud do semthing like : if you press any key, you will get as example 200 points which go down with the time. If you got no points, you'll respawn.
Title: Re: Restart game after after 2 minutes of inactivity
Post by: Kombiice on August 06, 2015, 05:25:52 AM
or set the points to 200
Title: Re: Restart game after after 2 minutes of inactivity
Post by: djaydino on August 06, 2015, 06:40:28 AM
Hi,
well it depends on what you are using, movement by keyboard / joystick / touch / mouse

if keys/joystic , you could for example use a global int variable and on the places that you have a key down action add 1 to that int and when released subtract 1

then on a separate fsm set a wait and an int compare

if the int is greater than 0 go to another state with also an int compare to check if the int is less than 1, to go back to the 1st state

if the int stays 0 for the time set in the wait action then go to the reset state.