How do I Animate character with Touch Input?

Get help using Construct 2

Post » Tue Oct 14, 2014 5:45 pm

I created a basic platformer game that uses the arrow keys to move and jump. It works great when the keyboard is used.

However, when I tried to implement the "Detect Input" example that comes with Construct 2 and use the on-screen arrow input, my character no longer does the walking animation when moving left/right, nor can they jump. The character just glides side to side when the on-screen arrows are used.

Any help is greatly appreciated.

Here's a short video showing it: youtube.com/watch?v=tnCd3PL8sCo
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 9
Reputation: 222

Post » Tue Oct 14, 2014 8:27 pm

I don't believe the "every tick" is needed prior to touch or keyboard events since they are triggered events via the touch/input action anyways.

You could also simply add the is touching condition as a -OR- to your keyboard arrow event and save repeating all the associated events.
You could still turn it off and on by making a variable that is either 0 for keyboard (default) or changed to 1 when player selects touch option (or mobile is detected).
You would then add a control (is-not-equal-to) 0 (or an is-equal-to 1) condition in the touch part of the -OR- event.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Tue Oct 14, 2014 8:36 pm

Oh sorry, the Every Tick method just contains something to check the players running speed. If they're running, they can jump a little higher. The Mobile controls aren't subevents on Every Tick.
B
4
Posts: 9
Reputation: 222

Post » Tue Oct 14, 2014 8:39 pm

My bad if I had of looked closely I would have seen they weren't attached to the controls. :)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Tue Oct 14, 2014 8:48 pm

The problem with using "Or" events is that I'm checking to see if "Right Arrow is down" and "Platform is on floor" to determine if the walking animation should play.

If I add "Is touching rightArrow" to it and make it an "Or" statement, it changes to:
"Right Arrow is down" or "Platform is on floor" or "Is touching rightArrow"

When I need it to be:
"Right Arrow is down" and "Platform is on floor"
-or-
"Is touching rightArrow" and "Platform is on floor"
B
4
Posts: 9
Reputation: 222

Post » Tue Oct 14, 2014 8:55 pm

sub events:

if platform is on floor
(sub)--right arrow is down
--------- OR
--------- is touching right arrow
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Oct 14, 2014 9:12 pm

spacedoubt wrote:sub events:

if platform is on floor
(sub)--right arrow is down
--------- OR
--------- is touching right arrow


Thanks for showing me how to set that up :)
Last edited by gfresh717 on Tue Oct 14, 2014 9:48 pm, edited 1 time in total.
B
4
Posts: 9
Reputation: 222

Post » Tue Oct 14, 2014 9:48 pm

I fixed the walking issues by saying if the player's platform is not moving and is facing right and if the right on-screen arrow isn't being touch, then play standing animation. This makes the player's walking animation happen with on-screen controls. I can't get jumping to work, though.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 9
Reputation: 222

Post » Tue Oct 14, 2014 10:34 pm

Is there a reason you're using the 8-direction controls in addition to the platform behaviour?

EDIT: oh, anyhow, it looks to me like you've got your jump actions on the event rather than the sub-event..
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Oct 14, 2014 10:56 pm

Are they not needed? I'm just trying to support web browsers on both computers and touch screens.
B
4
Posts: 9
Reputation: 222

Next

Return to How do I....?

Who is online

Users browsing this forum: alextro, tarek2, wenwen11212016 and 7 guests