Page 1 of 1

Re: Snake game on LCD using Flowcode 7

Posted: Tue Dec 18, 2018 9:02 am
by mnf
Hi,

You need some way to store the positions of each 'segment' of the snake. So you could use an array or a circular buffer. To move you draw the new 'head' of the snake and erase the last section - the contents of your storage need to reflect this (ie the new 'head' gets added to the front and the last element is deleted - if you are using a circular buffer you can amend the pointers to the front and back element of the snake and with an array - shift the contents of the array).
Your array or buffer needs to be large enough to store the longest possible snake.
Depending on the size of your display you can store each position as a byte (if the screen has <= 255 possible positions) or a word (possibly with x/y as high/low byte)

Martin

Re: Snake game on LCD using Flowcode 7

Posted: Tue Dec 18, 2018 12:11 pm
by Benj
Hello,

Have you seen this forum topic?
viewtopic.php?f=63&t=18360&p=78619#p78619

Re: Snake game on LCD using Flowcode 7

Posted: Tue Dec 18, 2018 12:42 pm
by Leshawn
Make sure to update this thread if you manage to figure this out, Masaladosa. I'd love to try your Snake game if possible.

Re: Snake game on LCD using Flowcode 7

Posted: Mon Dec 24, 2018 9:54 pm
by mnf