Anaconda clone help

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
H0lyT0ast
Prole
Posts: 7
Joined: Sun Feb 03, 2019 5:44 pm

Anaconda clone help

Post by H0lyT0ast »

Hi everyone,

Thanks for looking at my thread. I'm fairly new to game development and I've hit a road block. I am trying to make an anaconda clone, https://youtu.be/h22thYhPCNw
I cannot figure out how make the tail follow the head. If anyone has any examples that would be great. If not my question is what is the concept behind making the tail follow the head not on a grid?
All I could think of is storing every small movement and rotation in a table. Storing movement and rotation seems like a lot of overhead.

I'm stuck and it sucks
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Anaconda clone help

Post by pgimeno »

You can store segments in the table. If I understand correctly, there are three possible types of segment, maybe two: 1) a straight segment, 2) a curved segment with a certain radius and 3) a curved segment with a wider radius. I don't know what the speed depends on, maybe it's controlled by the player? and whether the turn rate varies when going fast, but if there are two speeds and the turn rate is constant no matter the speed, then there are two radii. Maybe the turn rate is higher when going faster, resulting in the same radius, I don't know.

Then you need to replay the segments in order from head to tail, to obtain the positions. You need to keep track of the length, in order to know where to stop and which segments can be deleted. The formula for the straight segments is the regular distance formula; the formula for the curved segments is angle in radians times radius.
User avatar
H0lyT0ast
Prole
Posts: 7
Joined: Sun Feb 03, 2019 5:44 pm

Re: Anaconda clone help

Post by H0lyT0ast »

Thanks for the help, I thought the table route would not work, but i made a concept and it seems to be the route I want. I'm going to mess with it more this weekend.

Thank you,

-Toast
Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests