0 Favourites

Touch object problem

  • Here are my events,

    <img src="https://dl.dropboxusercontent.com/u/260388836/My/Capture.PNG" border="0">

    This does not work.But logically,it should work,or is there something I don't know about touch?

    If I replace the two events with "else" it works.

    What's happening here? "else" and the events were the same.

    Here' the Capx

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Logic is the key word here.

    look at your code.

    Is in touch OR up arrow is down.

    Then you have Is not in touch OR Up arrow is NOT down

    So to go up the following conditions must be met:

    Is in touch

    OR

    up arrow is down.

    Or so it seems but it's not that simple because the conditions continue with:

    Is NOT in touch

    OR

    up arrow is NOT down.

    which triggers a different event than that which you want and expect. ie it goes down.

    So your logic says to you that if I touch or press up arrow the player goes up but the computer says that not only do both those conditions need to be met but the conditions at [3] must NOT be met in order for it to work.

    If we look at [3] in relation to [2] then:

    If in touch in 1 then X in touch at [3] is not met but x up arrow is down IS met and now the code tells it to go UP and Down simultaneously which is why it stalls and goes to "Still" ani. Press the up button and neither condition in [3] is met so it goes up but you thought that happened because there was a problem with the touch ie the up button was activating as per condition [1] when really it's de-activating the up button clause in [3].

    Suggest you look at the tutorial on detecting input type and work from there with two sets of controls dependent upon selected input type it's easier in the long run.

  • You'll find the same applies in reverse ie if up button is down it stalls until you apply an is in touch action once again it's not activating the condition [1] it's deactivating the is not in touch condition in [3] which is trying to send it downwards.

    Set yourself up a splash page with the following code in it (ignore the go to options).

    <img src="http://s11.postimg.org/3puyg8e0z/control.jpg" border="0" />

    Put the desktop controls in a group called "DesktopControls" and the mobile controls in a group called.... you guessed it.

    Use the global variable ControlMethod to activate/deactivate the appropriate group of controls at the start of the game then if the user clicks a mouse or presses a key they get mouse/keyboard input, if the user touches the screen on a mob device they get touch controls and no interference between the two sets.

  • Bertie Booster.Thank you...

    But isn't that TWO events.So one event should not be bothered about others.

    Edit: aah Now I get it.So the set of two inputs give 2 sets of probabilities for the same event.I will surely read the tutorial.

    While in the meantime,Can you please check whether this game of mine, Soul Flyer is shown in full screen mode?Sometimes it's shown like that and sometimes not.Also Can you hear the music?

  • You need to have a little look through the tuts just to gain an understanding of how some basic events work or you'll run into lots of problems.

    The "Else" worked in your example because if neither condition in [1] was met then it ran [3].

    Works for a one type movement but you will run into problems if you need anything other than a flappy bird up button unless you sort your input types out or do some seriously unnecesary logic.

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