0 Favourites

Local State Machine - anywhere - CAPX

  • Edit:

    Edited the topic in order to be able to share my experiments, also to explain better what is the point of it.

    OP:

    Hi all

    basically, i would like to have a state machine behavior, where i could use different event sheets as states for one object.

    for example:

    Object is called "Example"

    First state would be an event sheet of the same name, or even "Example-Main"

    this sheet runs a few actions, and one event would trigger a state change, requiring another event sheet.

    The object would invisibly change its actions to the ones contained in the new sheet, again with the possibility of changing to another state if a certain condition is met.

    Is this feasible?

  • You can already do this with subevents. Simply have a 'state' variable and change it, and it will use the sub events in the same manner. You don't even need to use separate event sheets, but if you want to, just use event sheet includes.

    If 'state' = "clockwise"

    • rotate sprite clockwise
    • (or include event sheet)

    If 'state' = "counter clockwise"

    • rotate sprite counter clockwise
    • (or include event sheet 2)
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • sounds good, and awesomely easy... as a C2 noob i never thought of that :p thanks!

  • i think i found a way to make a state machine using groups and a state name text variable.

    Local State Machine

    A good thing about it is that i can create state machines when needed, while still running global events! :) This goes one step forward from the engine i used previously, where everything ran on a state machine.

    Also edited OP and renamed topic. Can you please move it to an appropriate section?

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