How does snake work? 2dBox

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

How does snake work? 2dBox

Postby Nigan12 » Wed Aug 14, 2019 5:12 am

Hello everyone,,
When i say snake the game i don't mean the grid base one, i means which can move all 360 degrees like the one in miniclip.

http://www.miniclip.com/games/snake/en/

How would i do it in 2dbox, because i tryed making 5 circle body's and connect them with a joint, then if turn a corner how would i make sure that the body will only go where the the head was, because the body could go left but the head was going right and then start sping around the body, i did turn of gravity but im not sure how to make it so the body will only go where the head was. i was think of doing something like this
mobdro.bio/ luckypatcher.tips/ kodi.bio/
// store bodys old location

// move the head

// move the bodys to the other bodys old location e.g. head one moves from (0,0) to (1,0) then body 1 will move from (-1,0) to (head old location which is 0 ,0)

But that doesn't work because you can't change the angle of the body,

Any suggestions.
Nigan12
 
Posts: 2
Joined: Mon Jun 10, 2019 8:06 am

Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest