Looks like I finally made something with voxelspace terrain recent studies https://www.lexaloffle.com/bbs/?tid=35654
This Race The Sun partial demake is my first entry to #TweetTweetJam N°3, in Pico8 with a 560 characters limit !
The Goal
You must go as far as possible, with no sun :D
Controls
Use < / > arrow to move your ship
Ctrl + R to restart after crashing
Good luck and have fun !
I made a commented version of the code.
In the process, I saw I could win 3 more characters by inlining i in h=d[i]
and also make the death rotation slower by adding /4 to v+=0.02/4
What is missing most, I think, is a way to increase difficulty by the time, by adding more obstacle or make the ship faster.
d={} -- land colormap / texture v=0 -- view angle m=4 -- x on the map n=0 -- y on the map g=0 -- game state 0 running 1 dead ::★:: cls() -- "graphics engine", voxelspace z=44 while z>8 do -- defining zone to display w=z*cos(v) t=z*sin(v) o,p=-w-t+m,t-w+n+9 q,r=w-t+m-o,-w-t+n-p+9 -- each 2 columns of the screen for k=0,127,2 do -- pick the pixel in color-map i=bor(band(o,0x7f),shl(band(p,0x7f),7)) h=d[i] -- low land waves / height, could be 0 j=36-cos(o/64)*sin(p/64)*4 -- obstacle if(h==5) j=24 -- z perspective, 32 horizon l=32+j/z*24 -- display the "voxel" rectfill(k,l,k+1,127,h) -- preparing next pixel to pick o+=q/64 p+=r/64 end z-=1 end -- end of graphics "engine" -- pick up position in colormap f=bor(band(m-1,0x7f),shl(band(n-1,0x7f),7)) -- if collision, gamestate is ended if(d[f]==5)g=1 -- game is running if g==0 then -- smooth turning f=0 if (btn(0)) m-=1 f=-0.02 if (btn(1)) m+=1 f=0.02 v=0.7*v+f*0.3 -- preparing next texture line -- just behind viewpoint e=shl(band(n,0x7f),7) for i=e,e+127 do -- light/dark gray checkerboard d[i]=6+(flr(n/8)+flr(i/4))%2 end -- placing new obstacle randomly -- on the same line s=flr(e+rnd(127)) d[s]=5 d[s+1]=5 -- ship move forward n-=1 else -- game ended -- death rotation v+=0.02 ?"dead",56,24,9 end -- score ?-n,1,1,7 -- ship :d ?"☉",58,120,13 flip() goto ★ |
Make it get faster over time with _set_fps(), @dhostin. I talk about this HERE:
actually could you make the player more visible because its hard to see it
You can edit the last number of the line below, which is the color of the ship
?"☉",58,120,13 |
[Please log in to post a comment]