I spent some time this morning thinking about mini-games to add to my newest project Penny. No details really, but I decided adding a Snake type game would be nice. In an effort to strengthen my coding skills, I decided to whip one up together with the greatest Pokemon ever (http://www.destructoid.com/why-ekans-is-the-best-pokemon-168461.phtml
There are many different ways to implement the code, but the way I approached it was that each segment has two states: where it was and where it's going. With each tick of the game loop, it will move to where it's supposed to be going. The body piece behind it will set it's "where it's going" to the "where it was" of the piece in front of it. This way I don't have to queue up a huge list of turns. It will always know where to go as long as there's something in front of it.
Overall I think it worked out pretty well and I learned something today and that's a good thing. Play link below!
Related Link: http://www.shengames.com/flash/ekans/
LOOK WHO CAME: