restart group of action only clicking a button(sprite)

0 favourites
  • 3 posts
From the Asset Store
11 loops of RPG, chiptune/8-bit music. Suitable for any pixel art game.
  • hi, i'm working on a fnaf fangame, and i've gotten to the point where when the animatronic arrives in front of my office, i can click a button to give it an electric shock and get it back to the starting point (so as to restart all the actions that he did, and then reassembled them), the problem is that I don't know how I can restart a group of actions, so that I can put them all back together every time I click that button .. you know what I can do?


  • What you are looking for is, a state machine. Basically, a state machine is a series of code (actions and events) that contain and update a state variable with certain actions that can only be triggered if you are in a specific state. I built an example of a boss type fight using a state machine for a previous forum question that could help you out.

    Notice how each action checks the state value of the boss. Also remember, a state in a state machine must have an entrance case (an event that occurs in a different state that sets, or enters the new state) and an exit case (this is an event that is an entrance case to another state). Notice in the example how ever single state has at least one action that sets the state to a different state. These are the entrance and exit cases.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • so how i can use this?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)