How do I add an or condition

  • 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) )

    dropbox.com/s/df5ql4i6nslghza/platformgame.capx

  • 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.

  • It isn't working for me

    gyazo.com/4b2d38a25dad1bb9f85f86cd1de7f78b

  • Try:

    Hero is on floor

    (sub event) Right arrow is down OR on touched object

  • 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"

  • jeffige i want to remove the or between keyboard and is on floor

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)