How do I Make A Moving Snake

Get help using Construct 2

Post » Tue Aug 23, 2016 2:10 am

Hey all, I have a question that Im not sure even how to word. Do you know how in games a snake would be represented as balls or separate pieces to make it move? How is that done? How would that be done in C2?

Thank you for looking. :)
B
25
S
7
Posts: 79
Reputation: 2,267

Post » Tue Aug 23, 2016 2:44 am

In a traditional snake game, the segments of the snake actually don't move at all. The "head" piece leaves "body" segments behind as it moves, and the duration the "body" segment exists for determines the length of the snake.

Otherwise, you'll want to look into using waypoints system with an array.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Aug 23, 2016 4:15 am

For clarification, Im not making a Snake game. Im trying to make a snake like object like youd find in a Contra or Metal Slug game. Sometimes its an actual snake, often its an arm or something.
I got it to work by using the Pin behavior - If 3 segments made the snake as C (tail) B (body) A (head), Pin C to B and Pin B to A and give A directional behavior to "drive" the body segments (B,C)
Now, Im at a loss on how to pin the same segments of the body together, for example; C,B,B,B,A Any ideas?
Thanks :)
B
25
S
7
Posts: 79
Reputation: 2,267

Post » Tue Aug 23, 2016 4:30 am

Ah... not sure then. I believe there are some Pin examples when you go to "New Project" in the menu.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Aug 23, 2016 5:27 am

You can add number,x,y variables (3 variables). You move head only. Each tick you set x and y as actual position of snake parts then you move each snake part to position of previous one.
And use number value to knew order of peaces
B
22
S
3
Posts: 74
Reputation: 1,515

Post » Tue Aug 23, 2016 7:15 am

Now I feel like an idiot. Turns out just pinning a segment makes all segments of that type fall in line. Exactly like the pin/rope example I didnt bother to look at first. Sorry to waste your time.
B
25
S
7
Posts: 79
Reputation: 2,267


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Bootfit, brunopalermo, Exabot [Bot], Huemerson, unicornspitfire, Yahoo [Bot] and 1 guest