Advertisement

Nibbles type game (Snake)

Started by February 02, 2000 09:55 PM
0 comments, last by Ray745 24 years, 10 months ago
i am developing a nibbles or snake clone in windows where i have three parts of the snake in bitmaps, the head which is only shown at the very front, and tail, which is shown in back, and the body which is shown repeadtly for the length of the snake. every time the snake eats an apple on the screen i would like him to grow in length does anyone have any good algorithms as to how i could have it so whenever the snake eats an apple the middle body bitmap is added to the midle of the snake to elongate him, and not at the end? thanks alot If I only had a nickle for every problem I''ve had, I wouldn''t have anymore problems, but then I guess I wouldn''t have anymore nickles either...
If I only had a nickle for every problem I''ve had, I wouldn''t have anymore problems, but then I guess I wouldn''t have anymore nickles either...
It seems to me that you could do one of two things fairly easily:
First, easiest, you could have an array of bools, or chars or something, and have the head and the tail preset, and then whenever he eats an apple, you could shift all the elements that have been set to the right, and add another in the second element of the array (array[1]). Or, you could do the same, except with a linked list.
I don''t know if this is the best way to do it, just a quick thought. I''m not an expert or anything...

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge

This topic is closed to new replies.

Advertisement