Turn with the left and right arrows keys.
If you fall to the ground you can restart the cart (⏸ -> "reset cart").
x=9y=9u=0v=0 function _update60()cls(7)v+=.07l=sqrt(u*u+v*v)a=atan2(u,v) if(btn(0))a+=.014 if(btn(1))a-=.014 w=.03-cos(a*2)/50u=l*cos(a)v=l*sin(a)x=(x+u+8)%144-8 y+=v if(y>120)u*=.9v/=-2y=120 for b=a-w,a+w,w*2 do e=x-8*cos(b)line(x,121,e,121,6)line(x,y,e,y-8*sin(b),0)end end |
Annotated:
Neat and very smooth, though holding left or right down keeps you suspended indefinitely as far as I can tell so there's not much challenge.
I loved this, and also appreciate the extra love you gave by providing annotated code!
I may be missing something obvious here, but I can't for the life of me decide what you are representing with the letter u
The math & code I get, I just want to know what that 'u' means in your mind. I've tried to substitute everything I cam imagine, but I'm drawing a blank.
Thanks for sharing this!
@iiviiGames So ideally I'd name the velocity variables vx and vy. But we gotta save characters, so I usually go with a pair of letters that are next to each other in the alphabet. I like u and v since they match the velocity theme!
u-v is also commonly used as an alternative to x-y/x-y-z, such as UV coordinates in 3D graphics.
Okay, I thought it was an abstract thing, so that makes sense!
Very nice, @lucatron. That just barely fit in the TWEET space maximum 280-chars whereas your cart is 275-chars.
Here, I did a little compression and made it 272-chars.
In any case, gold star work !
[Please log in to post a comment]