How do I "OR"

Get help using Construct 2

Post » Sun Apr 12, 2015 12:41 pm

how do I add an OR statement to an event?

my dilemma is I have 8 "On Keyboard" events that each have 3 conditions. I know I could simply reproduce these with the "On Touch" event, but this would give me 16 events. If I could add an "OR" statement eg. "On Keyboard OR On Touch" It would reduce my number of events, reducing my final file size.

another way that i think i could achieve this would be "On Touch" -> Simulate "On Keyboard" like you can for "On Touch" -> Simulate "8 direction" but I cant find a way to do this either.

I know a lot of you will say "why not use 8 direction movement?" the reason for this is I am designing my own grid based movement system
B
11
S
4
G
3
Posts: 53
Reputation: 2,638

Post » Sun Apr 12, 2015 12:59 pm

How events work scroll down to or block.

Right click event in left corner and Make 'Or" block
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Sun Apr 12, 2015 1:04 pm

Start with an On Key Pressed trigger, or any key is down, depending on your needs. Then as a sub-condition use the system Compare Two Values expression. In the top line enter your 3 keyboard conditions separated by " | " (remove quotation marks). Like:

Keyboard.LastKeyCode = 50 | Keyboard.LastKeyCode = 51 | Keyboard.LastKeyCode = 52

These are the conditions you are "OR" checking for one of them to be TRUE, so the rest of the Compare Two Values should be "= 1 ", where 1 represents TRUE.

I personally use player control variables (booleans) where I set these to true or false at the start of the player control layout, so when I need to check if a control input is made I just check the single variable rather than repeating all of the above code.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Sun Apr 12, 2015 1:15 pm

thanks guys got this working now
B
11
S
4
G
3
Posts: 53
Reputation: 2,638


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 37 guests