How do I make a snail-like crawling character?

Get help using Construct 2

Post » Tue Nov 29, 2016 5:20 pm

Hello constructors, I have some trouble to figure out how to make a crawling character AI.
What I want to achieve is a computer controlled character which crawls along the edges of walls rotating accordingly.
The logic is shown in the picture.
Image
Normally the character crawls following a straight floor (A).
When he encounters a convex angle (from left to down) he rotates and then crawls down the wall (B).
When he encounters a convace angle (from left to up) he rotates and then crawls up the wall (C).
All of these logics should work in case any angle (D,E,F).
Also, since the character is "crawling to the right", these logics should be mirrored when he is "crawling to the left".
Any suggestions?
B
9
S
4
G
1
Posts: 32
Reputation: 871

Post » Fri Dec 02, 2016 7:13 am

Up
B
9
S
4
G
1
Posts: 32
Reputation: 871

Post » Tue Aug 01, 2017 11:44 am

Up
B
9
S
4
G
1
Posts: 32
Reputation: 871

Post » Tue Aug 01, 2017 12:07 pm

Sorry you haven't got a reply have you tried learning about the physics joint? I believe what you are trying to accomplish can be done either with physics joints and physics behavior or pin behavior and platform controls but either way you will have to intervene with the movement. I think simply getting your character to grip the walls will be more complex then getting copies of your character to follow. You will only need to create a on and off switch situation for when you collide with the side of an object rather than on top that takes gravity away, then checking overlapping at an offset you can test if the character one fraction up or down would stop colliding withobject and have character stop there and make them let go of button and press again to purposely fall or whether to perform a quick hop up at the top of a clinging climb.
B
8
S
2
Posts: 24
Reputation: 548

Post » Tue Aug 01, 2017 10:01 pm

Three ways come to mind.

1.
Positions small sprites around the snails to act as detectors to know the shape of the walls around it. Then have the snail move forward or turn accordingly. May need logic for both directions.

2.
Put sprites every spot the snail should turn. And when the snail hits then it stops and turns.
Here's an example. Tweaking the positions will make it better and it's fairly intuitive to do new levels.
https://www.dropbox.com/s/4dfaxu2k27hm3 ... .capx?dl=1
For the other direction just use different sprites.

3.
Put sprites right on the spot the snail should turn, and use it as a path to follow. Will require more events but it can be reused for both directions.

There are other examples elsewhere on the forum if the links still work.
B
92
S
32
G
107
Posts: 5,280
Reputation: 69,971

Post » Thu Sep 07, 2017 2:08 pm

Thanks both for your answers, while waiting for an aswer i almost reached the behaviour I want using some "helpers sprites" which turn when they hit a wall or a block ends, yet is still buggy
B
9
S
4
G
1
Posts: 32
Reputation: 871


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, Yahoo [Bot] and 23 guests