# Why is my Snake' tail rendering the wrong sprite? [closed]

I am making a snake game in Unity. The game is simple, using Texture2D to display the head, tail and body parts.

I am stuck with this problem: I stored 4 textures (each one for one of the four directions) for the head and tail. I check the direction and in onGUI, I select the appropriate image. The snake displays correctly, but the tail image doesn't:

How can I fix this?

• Could you be a bit more specific as to what is not working: what direction do you get, and what direction do you expect. Also, it might help to post the relevant piece(s) of code that selects the picture based on orientation. – MicroVirus Apr 16 '14 at 11:53
• I just thought of one other thing that could be the issue. You're probably keeping your tail oriented as it was originally, but if you are going 1 up and then 1 right, then after the tail has gone one up it still points up, right? But you'd want it to point to the right now, because that's where the rest of the body is. If that's the case, you'll need to pick differently for the tail depending on whether it's on a corner piece of your movement. – MicroVirus Apr 16 '14 at 11:56
• Exactly @MicroVirus Exactly !!! But I am unable to figure it out. As I have tried so many things. I put every direction on list, another made array to store previous directions but the tail is never synchronous. :( – Adnan Nazir Apr 16 '14 at 11:59
• The Snake is a doubly linked list. What you need is a list of positions. Where each position in the list points to the next position. Then the tail checks where is the next position is and compares it with its position and points that way. – AturSams Apr 17 '14 at 4:11

o o }         < 0 0 }