Log In  

Cart #another_3d_snake-0 | 2021-11-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
19

it's the game snake, but 3D, in 552 bytes! this lil thing was made for TweetTweetJam 7.

moving: steer with left/right - steering is also how you move forward, because you are a snake

growing: eating olives is how you grow longer, because you are a snake

losing: touching your tail with your face is how you start over, because you are a snake in a video game

if you grow your tail so long that your framerate suddenly reduces to garbage: you win!


the code is nonsense, since it's a tweetjam, but here it is!

p={0,0,0,0}b=0a=0g=0h=0::_::cls(15)w=btn()w=w%2-w\2%2m=w*w*2a+=w*.015p[3]+=m*cos(a)p[4]+=m*sin(a)q=p[3]r=p[4]g+=(q-g)/9h+=(r-h)/9b+=(a-b)/40s=sin(-b)c=cos(-b)for j=0,1do
for i=1,#p,2do
_=min(i,2)u=p[i]v=p[i+1]f=_+2if(1-j)*i>=5then
x=p[i-2]y=p[i-1]u-=x
v-=y
l=2/(u*u+v*v)^.5u=x+u*l
v=y+v*l
p[i]=u
p[i+1]=v
end
if abs(q-u)+abs(r-v)<30-_*10then
if i<2then
for j=1,36do
add(p,p[#p-1])end
p[1]=rnd(198)-99p[2]=rnd(198)-99
elseif i>40then
run()
end
end
u-=g
v-=h
u,v=s*u+c*v,c*u-s*v
k=99/max(150+v,1)circfill(64+u*k,34+60*k-j,5*k-j,f+j*5)end
end
flip()goto _
P#100576 2021-11-21 21:03

2

I love how this game naturally leads to you moving in a snake-like fashion, going side to side.

P#141029 2024-02-02 18:53
1

I'm really obsessed with this since it resurfaced on the BBS, what a cool concept and at 552 bytes it's really impressive!

This code is a great example of some that can benefit from poking the memory address 0x5f36 with value 2 to enable circ and circfill with even diameters:

poke(0x5f36,2)

(if you want to spend the bytes for that!)

P#141048 2024-02-03 00:44

The snake kinda looks like a noodle

P#142327 2024-03-02 17:04

[Please log in to post a comment]