How do I add an or condition

Get help using Construct 2

Post » Sun Jan 08, 2017 8:04 am

Message: kab can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Look at event 4 but i cannot add an or condition

I want something like this

if (( Keyboard Right arrow is down AND hero_shadow is on floor ) OR ( Touch on Tap Object) )

https://www.dropbox.com/s/df5ql4i6nslghza/platformgame.capx?dl=0
B
5
S
1
Posts: 32
Reputation: 389

Post » Sun Jan 08, 2017 9:10 am

I'm not at my laptop so i can't see your capx...

But...

To make an 'or' condition - click on the left most part of the event, so both the event AND action are highlighted. Right click (i believe) and a box will appear.

Click on 'make or block'

Repeat the right click action as i said above. This time choose 'add event below'.

Add your 'Touch - on Touched object' event.

Now click and hold in the middle of that event, drag it up to the event above.

It should look like:

Keyboard - Right arrow is down
Hero is on floor

OR

Touch - On Touched object.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Sun Jan 08, 2017 10:40 am

Message: kab can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
It isn't working for me

https://gyazo.com/4b2d38a25dad1bb9f85f86cd1de7f78b
B
5
S
1
Posts: 32
Reputation: 389

Post » Sun Jan 08, 2017 11:37 am

Try:

Hero is on floor
(sub event) Right arrow is down OR on touched object
B
20
S
8
G
3
Posts: 458
Reputation: 4,055

Post » Sun Jan 08, 2017 11:57 am

@kab I understand now after seeing your image. You can't have the 'or' between keyboard and is on floor.

What @mekonbekon says should work.

1st you have to test if hero is on floor (main event)

Right click on that event > ADD - sub event > Right arrow is down

Right click on that event again > ADD - sub event > Touch

Imo it's better to separate desktop and mobile controls, each in their own group.

At the start of the game, if they TOUCH play - System > set group active "mobile controls"

On any key pressed (or whatever key you want) - System > set group active "desktop controls"
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Sun Jan 08, 2017 12:26 pm

@jeffige i want to remove the or between keyboard and is on floor
B
5
S
1
Posts: 32
Reputation: 389

Post » Sun Jan 08, 2017 12:40 pm

@mekonbekon it seems your solution will work...i will test it soon

if i press arrow up on keyboard the player will jump in place , what will be the equivalent for mobile.If i do Is Touching arrow up -> simulate control --> i don't see up control
B
5
S
1
Posts: 32
Reputation: 389

Post » Sun Jan 08, 2017 12:47 pm

@kab Yes.

Cause with the 'or' in between keyboard and floor, hero can still move right if he IS NOT on the floor.

You want 'On the floor' to be the main event on both keyboard and touch.

(main event) on floor
(sub-event) keyboard

(main event) on floor
(sub-event) on touch

If you are making a platformer - use platform behavior. Then:

Touch > On touched ARROW UP - Hero > Simulate platform pressing jump.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107


Return to How do I....?

Who is online

Users browsing this forum: Kin, mickclarke, tinhofiel, TRMG and 55 guests