Grab The Green Guy

A little game made for #TweetTweetJam. Made with less than 560 characters! (559 to be exact)

This was my first code golfing attempt, and I had a blast. 

I hope you enjoy the game!  -- Cody

HOW TO PLAY

Navigate the little black worm, and grab the green guy! Avoid the red guy or he will reset your score. 
The more you hold, the faster you'll go. So slow down to stay maneuverable. Take your time!

CODE - 559 CHARS

w=128i=.1r=rnd
function n(c)return{x=64,y=64,z=0,w=0,d=function(s)line(s.x,s.y,s.x-s.z*2,s.y-s.w*2,c)end,u=function(s)
s.x+=s.z
s.x%=128
s.y+=s.w
s.y%=128
end}end::q::a=n(0)v=n(3)b=n(8)b.x=r(w)b.y=r(w)j=0t=btn::_::f=abs
g=6s=0
if(t(⬇️))a.w+=i
if(t(⬆️))a.w-=i
if(t(⬅️))a.z-=i
if(t(➡️))a.z+=i
if(f(a.x-v.x)<6 and f(a.y-v.y)<6)then v.x=r(w)v.y=r(w)j+=1 g=3
end
if(f(a.x-b.x)<4 and f(a.y-b.y)<4)then g=8
end
v.w=r(1)-r(2)v.z=r(1)-r(2)b.w=r(2)-r(1)b.z=r(2)-r(1)cls(g)a:u()v:u()b:u()v:d()b:d()a:d()print("grab the green guy   score:"..j,5,5)flip()
if(g==8)goto q
goto _

Comments

Log in with itch.io to leave a comment.

(+1)

These are some really pleasing movement mechanics, great job!