Java cooperation home
Tutorial
type and press Enter

Snakin Movement

Again I don't have enough time to write a whole chapter about this problem (even though it would be really necessary, because it is not that simple to understand). I used this technique together with the level editor, I explained to you a few chapters ago in my game Snakin . Well here comes a short description of the problem: We want to move a snake around but we don't want to repaint the whole applet everytime we execute the thread. To make this possible, we will add a new Snake Element at the head of the snake and we repaint the last element of the snake in a new color (the color of the background). Well all the other things are in the sourcecode (you can download it at the end of the chapter). I know it won't be simple to understand it, because all comments are in German but if you are a experienced programmer it should be no problem for you and this is really a difficult chapter!

Oh, well, click on the applet and move the snake with the cursor keys. If you want to make the snake longer, you have to press Space Bar. Alright here comes the download link:

SourceCode download
Fabian Birzele, 2001-2003.
web-design: Vadim Murzagalin, 2004.