Touch object problem

Get help using Construct 2

Post » Sun Feb 09, 2014 3:04 pm

Here are my events,


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
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Feb 09, 2014 3:43 pm

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.

There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Sun Feb 09, 2014 3:58 pm

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



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.
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Sun Feb 09, 2014 4:33 pm

@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?Doc Ai2014-02-09 16:40:13
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Feb 09, 2014 5:10 pm

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.
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797


Return to How do I....?

Who is online

Users browsing this forum: Ashley, dop2000, jatoblendy, MathNook, tarek2, Yahoo [Bot] and 29 guests