Local State Machine - anywhere - CAPX

Looking to build a team or have a job to offer?

Post » Fri Apr 12, 2013 2:41 pm

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?KZR2013-04-18 03:02:55
Image
Image
Image
B
15
S
2
Posts: 48
Reputation: 1,595

Post » Fri Apr 12, 2013 10:18 pm

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)
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Sun Apr 14, 2013 2:16 pm

sounds good, and awesomely easy... as a C2 noob i never thought of that :p thanks!
Image
Image
Image
B
15
S
2
Posts: 48
Reputation: 1,595

Post » Thu Apr 18, 2013 3:03 am

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?
Image
Image
Image
B
15
S
2
Posts: 48
Reputation: 1,595


Return to Job Offers and Team Requests

Who is online

Users browsing this forum: No registered users and 3 guests