3
\$\begingroup\$

I'm trying to create a click to move snake game on mobile but I'm having problems with the whole click to move functions and adding a body part every time my snake eats an apple. I want to make the click to move smooth you know like an actual snake is slithering around and when the snake eats an apple, I want to add another body part to my snake (maximum of body parts should be 5). Can anyone point me into the right direction or give me an example of what to do, thank you!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ What have you tried so far? The next step will depend on how the parts you've already built are working, so you should show the relevant bits of your code or scene hierarchy setup. \$\endgroup\$
    – DMGregory
    Mar 9, 2017 at 22:38
  • \$\begingroup\$ (Also, note that we get a lot of questions about making Snake clones, so do a quick search through the existing questions to see if the answer you're looking for might already be there) \$\endgroup\$
    – DMGregory
    Mar 10, 2017 at 0:46

1 Answer 1

1
\$\begingroup\$

The "smooth slithering" could use some more explanation, but assuming you want more gradual turns than the normal 90 degree snake game, you could instead deal with simply a turn left and a turn right event from the player input. This would apply a rotation to the velocity vector of the head, such as one degree per update. This is different from your typical snake game where input determines the absolute direction, not the change in direction.

This control setup may be the best for mobile where you can simply track tap/hold events on each half of the screen. If I press my left thumb to the left side of the screen, the snake will turn left. If I press the right side with my right thumb, the snake gradually turns right. If I lift both my thumbs, the snake goes straight.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .