Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / snake enemy help

Author
Message
mr joe
21
Years of Service
User Offline
Joined: 12th Aug 2004
Location: Edinburger, Scotland. DBC
Posted: 2nd Dec 2005 18:48
Hello,

I'm in the middle of a top down 2d shooter game. It's something like a cross between robotron and bomberman perhaps. Anyway, it seems to be going well but I'm having a problem with an enemy type I introduced. The enemy is like a snake which is made up of 5 pieces. At the moment I have the head piece working fine. If you go directly above, below, to the left or right of it then it moves across the screen to where it you were (Everything in the game moves strictly on two axis, up-down and left-right, you can't go diagonally).

Anyway I don't know how I should get the tail pieces to follow behind the head. First i made them all act like the head, and go to the place where you were last, but starting off behind the head and stopping moving when the head did. This was mostly ok except often the parts would go out of sync or pile up together.

My question: does anyone have any ideas how I could make the body parts work better? Ideally I think their positions would be related to each other rather than moving independently, but I can't figure a way to do this.

Thanks for reading such a long post and hope you can help me.

Joe
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 3rd Dec 2005 11:39
You can download my snake game, Kiss My Asp! it has the full source code with it. So, take a look and work out what you need from that.
If you still need help, ask again.


Great Britain would be Amazing Britain if it wasn't for idiots like you bringing down the average!
mr joe
21
Years of Service
User Offline
Joined: 12th Aug 2004
Location: Edinburger, Scotland. DBC
Posted: 3rd Dec 2005 21:48
Thanks. I just put in the same system (or similar at least, I think) and it works perfectly.

Login to post a reply

Server time is: 2026-07-06 17:12:08
Your offset time is: 2026-07-06 17:12:08