Secret Of The Snake

Published 2023-06-12



update: put helpful remarks in ALL of code now.

This is not a very complex cart, or perhaps it is.

The classic SNAKE game has been around for many years and during that time some innovative programmers have figured out unique, interesting, and compact ways of handling it.

It's not simply drawing a line, it creates a trail that disappears behind the player according to how far in the game they are.

There are many approaches to writing this. As for me, I have always opted to ID the entire screen, in this case, all 15x15 tiles and use a number to represent a part of the snake.

The higher the number the longer it will be in play. Albeit a lower number means it will vanish more quickly.

To update this I have a sweep of the entire playing area and if one of the tiles is a number that is greater to or equals one, then it decreases by one. So you need only plot a number behind where the player just was, to create this trail effect.

My question to you is how would =YOU= do it more efficiently ?

This is open to any and all programmers, not just you aces and veterans but those who are either learning to program in Pico-8 or have for a-while.

How would you code your SNAKE in the most efficient manner possible, and please, include the source.

Chances are one of us (likely me) will learn something from it. :)