playMaker

Author Topic: Restart game after after 2 minutes of inactivity  (Read 1734 times)

kenmarold

  • Playmaker Newbie
  • *
  • Posts: 14
Restart game after after 2 minutes of inactivity
« 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?

Kombiice

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Restart game after after 2 minutes of inactivity
« Reply #1 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.
Still learning ^^

Kombiice

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Restart game after after 2 minutes of inactivity
« Reply #2 on: August 06, 2015, 05:25:52 AM »
or set the points to 200
Still learning ^^

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Restart game after after 2 minutes of inactivity
« Reply #3 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.