snake game tail help

Can any one write me a snake tail java script in 3d. When ever the snake eat food the tail of the snake should grow.

If not give me a brief idea how to write it.

search for snake game on unity answers there are several posts that include relevant information. No one is going to write you a script

2 Answers

2

No one, please, write this guy a script..

To help you write one however.

If snake hits a thing, destroy thing, add _ to the snake. You can have the snake grow by making it longer, by adding more segments, or whatever, that's your choice...

To have it do the colliding stuff: http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html

To help on destroy: http://panther.unity3d.com/support/documentation/ScriptReference/Object.Destroy.html

For adding something to a snake, depends on how you do it...

For movement, you need input: http://unity3d.com/support/documentation/ScriptReference/Input.html

And to actually make the snake move, you can use a cross between transform or you can do something with rotate, or rotateto: http://unity3d.com/support/documentation/ScriptReference/Transform.html

That's good for both ideas...

Now, good luck! Post some script that YOU wrote, and make sure you use the 10101 button up top, and we can help you further! Or... not we... I'll help you further =).

For the tail you could consider using multiple gameObjects like boxes. Put references to them into an array. Everytime you move the first box, go through the array and adjust positions. The second box goes to the position of the first, the third to the position of the second, and so on.

If you collide with a new box, just add it to the array.

Could be a simple way to do it. Just ask if you have further questions.

By the way.. write-my-code is a bad tag to choose! There's no learning in this ;)