How do I platformer tap to move

Just started using Construct 2? Post your questions here

Post » Sun Apr 03, 2016 6:58 pm

I'm trying to make a character be able to move around a side scrolling environment via tapping then having the character be able to navigate to that location.

At first I tried pathfinding. But was unable to figure out how to keep the character grounded on the floor of the environment.

Next I tried a combination of the platformer behavior and the 8 direction one for when the player needs to climb up a ladder.

Im making a series of conditions that look at the height Vs side of the tap location Vs the player position. And determining things like I'd the player is overlapping a ladder etc, but it's still not quite working smoothly.

Does anyone have a test scene with a control setup like this or another way to approach this type of movement to?

Thx
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Mon Apr 04, 2016 1:18 am

Have you checked out this tutorial yet?
https://www.scirra.com/tutorials/1115/a ... latformers

One thing you can do is have triggers set all around the environment that change the character's 'state' as it approaches an obstacle or ladder or such. For example, a jump trigger on either side of a pit, or a climb trigger at the base of a ladder. The jump trigger would of course active the jump action, and the climb trigger actives the 'Climb' state, which plays the climbing animation as they move up the ladder, as well as whatever climb behavior you have set, so long as the character's state is currently set to 'Climb.'

If you click to the right of the character, and they're not on a ladder or in the middle of a jump, you start the 'Right' state, in which they continuously simulate right movement. Ditto for clicking to their left and activating the 'Left' state. If they're about to walk over a pit, there should be jump triggers there that make the character automatically jump once it collides with them.

That would work for very simple cases, step by step or trigger to trigger, but it wouldn't work in more advanced cases. For example, in this case:
Image

You can click on the checkmark, but since the ladder is to the character's left and the right-ward click means the 'Right' state has been activated, the character wouldn't properly reach the climb trigger to go up the ladder. You have to figure out what the next step is (the ladder) and click on it, and once you're up the ladder think about the next step (go right) and so on.

I suppose to go more steps ahead automatically, you'd need to make these triggers perform double duty as waypoints. Here's a bit on that from the same guy:
https://www.scirra.com/tutorials/1113/a ... -waypoints

Not entirely sure how to implement that, aside from having every waypoint know what path needs to be taken to reach any other waypoint. Hopefully someone has an easier solution for a more advanced pathfinding.
B
20
S
5
Posts: 23
Reputation: 1,283

Post » Mon Apr 04, 2016 10:49 pm

Thanks @Nemlokt - Lots of great information!
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest