DOOMY (overdue Pico-1k jam)
DOOMY, a tiny first person shooter in 1024 bytes, with collision detection, arbitrary walls, texture w. fog, sound effects, a couple of baddies and a death screen πΉπΊπ₯
Controls & Goal
Move around with the Left, Right and Up arrow keys. Shoot with X or C.
You start with 10 health points, and need to shoot as many baddies until they get you good!
Inspiration
Seeing great and cute entries closing Pico-1k jam was inspiring. That's when I got an idea: "all things SSPR" to balance this cuteness with DOOMY pointless violence and big pixels.
Technical details
In a nutshell DOOMY is a rotozoom (the effect you get when rotating and zooming an image) laid down flat and rendered with scaled sprites.
Setup
The textures, sprites, and the base of the level are rendered as a group of rectfill and text in the first 3 lines of code, with first two textures of 8x8 for the walls, then 2 baddies, and finally the base of the level.
In the following 4 lines, the base of the level is expanded and some diagonal walls are added.
Every "thing" in DOOMY goes in the β₯ object which contains the x,y,t,w properties for the x,y position of the thing, it's texture index t and width w (nil or 1 for walls, 8 for the baddies)
Game loop
In the game loop the things in β₯ are rotated and moved into another object, π±, if they are in the visibility fustrum. The baddies move erratically towards the player.
The things in π± are then sorted and rendered back to front, if one of these thing is large, it means it's a baddy and we render a shadow with an ovalfill
Collisions and baddies hit
For the collision detection, we check the distance of the last thing we drew. Blocking the way forward if it's very close.
We check the color of the pixel under the crosshair to know if it's a baddy. If you shoot we play a noise, increase the score and respawn it at a random location. Otherwise there is a 10% chance it will shoot you with a red flash and some noise.
You know the baddies are bad because they keep shooting you even when you're down!
Source code
u=.2v=1.5a=0p=0h=10β₯={}r=rectfill f=add cls()r(0,0,15,7,13)f(β₯,{x=3,y=4,t=24,w=8})?"#%$3αΆ9μαΆ8][β",r(0,1,15,6,5),3,3 β=pget?"β %= αΆ8π±z}",f(β₯,{x=4,y=5,t=16,w=8}),1,6 memcpy(0,6^13,β§)for y=0,9,1/8do for x=0,9,1/8do if(β(x+32,y)!=β(x+31.9,y-.1))f(β₯,{x=x;y=y;t=(x+y)%2*8})end if(y<2)f(β₯,{x=2.5+y/2;y=4-y%1+y\1*2;t=y%2*8})end function _draw()cls(1)r(0,60,127,68,5)l=rnd local π±,c,s,q,d,w,x,y={},cos(a)*8,sin(a)*8,64 for z in all(β₯)do x=z.x-u y=z.y-v if(z.w)z.x-=(x/q+l()-β)/9z.y-=(y/q+l()-β)/9 z.u=y*c-x*s z.v=y*s+x*c if(z.v<48and abs(z.u)<z.v)f(π±,z)end for i=2,#π± do for j=1,i do if(π±[i].v>π±[j].v)π±[i],π±[j]=π±[j],π±[i]end end e=6-2*min(1,h)pal(6,13)for d in all(π±)do z=80/d.v if(z>4)pal() w=d.w or 1x=q+z*(d.u-w/2)y=q-z*e if(w>1)ovalfill(x,y+z*9,x+z*w*.9,y+z*7,0) sspr(d.t,0,w,8,x,y,z*w+4,z*8)end b=btn()*min(1,h)a+=(b%2-b\2%2)/q if(b&4>0and z<40)u+=c/q v+=s/q ?"αΆeβΆwβΆtdoomy",44,4 ?"♥"..h.." β "..p,44,119 c=β(q,q)w="\ai60"?"+",q,q if(c>7and c<13)then if(b>15)p+=1d=β₯[c-7]d.x=l(8)d.y=l(8)?w if(l()<.1)pal(1,8,1)h=max(h-1)?w end end |
That's all folks
Hope you enjoy this tiny showdown
Neat! This works surprisingly well, and the fact that you technically have depth-based lighting and shadows is kind of amazing. If you could find a way to squeeze in backwards movement, that would be cool, but impressive job anyway.
My high score so far is 29.
Pretty cool how little you really need to make an FPS, but not having a gun is a little bit strange. Great job overall!
This is such a great 1k game!
Plays really well too, considering the limitations.
Thanks for the technical write-up also, very interesting.
Congrats again on squeezing it all in! π€π
This is amazing. Do you have the "clean and commented" version anywhere?
damn
is kinda weird i dont have a gun...
:l
good games though!!
[Please log in to post a comment]