How do I combina AND-blocks and OR-blocks?

Get help using Construct 2

Post » Sun Aug 16, 2015 5:05 pm

I know how to make several AND events, and how to make OR-blocks. But is there a way to make both in the same without creating sub-events?

Like for example:
If (Touch AND Overlapping) OR Keydown
Image
B
14
S
4
Posts: 145
Reputation: 1,948

Post » Sun Aug 16, 2015 5:20 pm

There probably is, but I would be inclined not to. If you have complex logic then it can be better handled by being broken up using subevents, or using local variables to store interim values, or using Families to group sprites together (for example). Clarity and readability are usually more important than brevity.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Sun Aug 16, 2015 7:06 pm

You can use variables
Image
B
21
S
8
G
6
Posts: 177
Reputation: 8,134

Post » Sun Aug 16, 2015 9:38 pm

I guess subevents would be the best solution then? The solution with variables might get a bit messy in larger projects.
Image
B
14
S
4
Posts: 145
Reputation: 1,948

Post » Mon Aug 17, 2015 6:53 pm

It really depends on individual cases. Pick whatever makes your code clearest - sometimes this is variables, sometimes it is expressions, sometimes it is events.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Mon Aug 17, 2015 10:01 pm

Use object families.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830


Return to How do I....?

Who is online

Users browsing this forum: Lightstone, Resslx, totoe and 25 guests