Branch Programming - Visual Edition

Get help using Construct 2

Post » Wed Oct 22, 2014 8:25 pm

I was wondering. Has anyone thought of this yet ? I'm aware construct sets the bar really high for some features and it's really complete, but some simple necessities feel like a hard-to-get result when you have a billion conditions that limit them or enable them.

In construct you can have a character, for instance:
-walk
-run
-crouch
-attack

I need to make conditions within these 4 stances to make it understandable that you can attack while walking. You can attack while crouching. You cannot attack while running, you cannot run while crouching and so on.

This system can turn quite confusing if your game has a bunch of stances to wich priorities may vary, so I was wondering about branching and if there was a possible way to get it to C2.

Image

This way you can link which actions are conditioned to a current one, and not make exceptions to every other actions that are not currently 'true'.
I don't know. This would also make animation workflow much simpler. :)
B
20
S
2
G
3
Posts: 60
Reputation: 3,766

Post » Wed Oct 22, 2014 8:42 pm

Why not use Booleans?
on key x pressed, and variable run = false, then attack
Image ImageImage
B
168
S
50
G
163
Posts: 8,220
Reputation: 105,059

Post » Wed Oct 22, 2014 8:57 pm

yes, you can use a Boolean, actually for all of my test and project, my character can run, jump, swim...etc and use different weapons, at the same time....with like 40 event (or less)

I means, if you use just one sprite for you character, you can make a different animation for everythings (mario style...)

If you would like to make an advance animation, you have to "split" your character in different sprite, like arms, body...etc

and you can make a "dinamic" animation for everything...for my opinion, the last one is better, but depends....
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Wed Oct 22, 2014 9:39 pm

The way I'm currently managing it is with booleans actually. The only part that pains me is that when there are MANY booleans, your conditions turn into a giant list like

IsStand
XIsWalk
XIsRunning
XIsAttacking
XIsJumping
XIsSpecial
XIsEtc...

So you have to limit conditions based on a big list of booleans and (if it happens that you want to add a new state/boolean) you'll have to retrace all of the current actions to add that exception/permission to every other action you've already set.

It's just no that practical :(
B
20
S
2
G
3
Posts: 60
Reputation: 3,766

Post » Wed Oct 22, 2014 9:55 pm

There is a FSM plugin but TBH I haven't worked it out.

Adding a finite state machine as a 'first class' concept in Construct would be great, with visual editing tools. It's something virtually every game needs.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Oct 22, 2014 10:02 pm

You could just get rid of those booleans and use "if playing animation" checking instead and use a single boolean like "Busy" which activates when player is doing something that restricts movement etc. In my game I just set "Busy = 0" into all controlling events and set it to 1 when attacking, jumping etc. There's also a boolean for jumping so player can still move left and right during the animation. All of this also works well with my rather complex AI system.
B
21
S
7
G
4
Posts: 231
Reputation: 3,470

Post » Wed Oct 22, 2014 10:03 pm

@LEMONDROP You could probably use arrays for this. I use arrays for a weapon switching system and it is minimal events. Same principle here could be used. Not at my home computer so can't upload a CAPX
B
13
S
5
G
1
Posts: 119
Reputation: 2,292

Post » Wed Oct 22, 2014 10:40 pm

Booleans is the way to go. Or just go with the FSM Plugin which work quite well.
B
43
S
12
G
14
Posts: 488
Reputation: 10,570


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, SERG 04 and 2 guests