Challenge:
Winner?:
No
Code Snippet:
`**Asteroids Remake** `¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ `Game setup Sync on : Sync rate 60 Set display mode 1024,768,16 : Hide Mouse `Variables Dim Px(3) as float : Dim Py(3) as float Dim Fx(3) as Float : Dim Fy(3) as float Dim Bx(4) as Float : Dim By(4) as float thrust#=10.0 : mass#=30.0 : size#=10 Shipcol=rgb(255,255,255) : Flame=rgb(255,255,0) x#=screen width()/2 : y#=screen height()/2 drag#=0.98 `**Main Loop** Do Cls `Store Old Positions oldx#=x# : oldy#=y# `Controls If upkey()=1 then fx#=sin(a#)*thrust# : fy#=cos(a#)*thrust# If downkey()=1 then fx#=-sin(a#)*thrust# : fy#=-cos(a#)*thrust# if upkey()=0 and downkey()=0 then fx#=0 : fy#=0 If leftkey()=1 then A#=wrapvalue(A#+5.0) If rightkey()=1 then A#=wrapvalue(A#-5.0) `Update Ship Controls ax#=fx#/mass# : ay#=fy#/mass# vx#=vx#+ax# : vy#=vy#+ay# vx#=vx#*drag# : vy#=vy#*drag# `Update Position X#=X#+Vx# : Y#=Y#+Vy# if x#>screen width() then x#=0 if y#>screen height() then y#=0 if x#<0 then x#=screen width() if y#<0 then y#=screen height() `Draw Ship px(1)=x#+(sin(A#)*size#) : py(1)=y#+(cos(A#)*size#) px(2)=x#+(sin(wrapvalue(A#+135))*size#) : py(2)=y#+(cos(wrapvalue(A#+135))*size#) px(3)=x#+(sin(wrapvalue(A#-135))*size#) : py(3)=y#+(cos(wrapvalue(A#-135))*size#) ink shipcol,0 line px(1),py(1),px(2),py(2) line px(1),py(1),px(3),py(3) line px(2),py(2),px(3),py(3) fx(1)=x#+(sin(wrapvalue(a#+180))*13) : fy(1)=y#+(cos(wrapvalue(a#+180))*13) fx(2)=x#+(sin(wrapvalue(a#+150))*7) : fy(2)=y#+(cos(wrapvalue(a#+150))*7) fx(3)=x#+(sin(wrapvalue(a#-150))*7) : fy(3)=y#+(cos(wrapvalue(a#-150))*7) bx(1)=x#+(sin(wrapvalue(A#-135))*size#) : by(1)=y#+(cos(wrapvalue(A#-135))*size#) bx(2)=x#+(sin(wrapvalue(A#-90))*size#) : by(2)=y#+(cos(wrapvalue(A#-90))*size#) bx(3)=x#+(sin(wrapvalue(A#+135))*size#) : by(3)=y#+(cos(wrapvalue(A#+135))*size#) bx(4)=x#+(sin(wrapvalue(A#+90))*size#) : by(4)=y#+(cos(wrapvalue(A#+90))*size#) ink flame,0 if upkey()=1 line fx(1),fy(1),fx(2),fy(2) line fx(1),fy(1),fx(3),fy(3) endif if downkey()=1 line bx(1),by(1),bx(2),by(2) line bx(3),by(3),bx(4),by(4) endif box x-2,y-2,x+2,y+2 `**End Loop** Sync Loop