FnOff
AxesOff
ClrDraw
randInt(5,90 -> A
randInt(5,60 -> B
SetUpEditor LSNY
SetUpEditor LSNX
5 -> W
W -> dim(LSNX
W -> dim(LSNY
26 -> U:U -> K:1 -> C
Repeat K=45
getkey -> K
If K:Then
K -> U
Else:U->K
End
A-(k=24)+(K=26) -> A
B-(k=25)+(K=34) -> B
If A>93:1 -> A
If A<1:93 -> A
If B>62:1 -> B
If B<1:62 -> B
Pxl-Off(LSNY(C)),LSNX(C)
Pxl-On(B,A)
A -> LSNX(C
B -> LSNX(C
C+1 -> C
IF C>dim(LSNX
1 -> C
End
ClrHome
That's all!
It is adapted from my snake code (with food and growth) so some code might seem odd.
-> is the sto key
In LSNX/Y the starting L is the list character (small capital L)
Changing the code that sets the value of W will change the length of the snake. (changing it to 15 -> W would set the length to 15)
I don't have time unfortunately to add a full explanation, but here is a list of what each variable represents;
A: snake's head's current x location (in pixels)
B: snake's head's current y location (in pixels)
LSNX list of the snakes's body's x coords
LSNY list of the snakes's body's y coords
C keeps track of which body slot should be modified
K is the key pressed
U is the last key pressed (assuming no key was pressed)
W sets the starting length of the snake (changing it doesn't do anything once the game has started)
Let me know if it doesn't work I may have messed up typing it in.
By the way, welcome!