Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
A jam submission

Virus DefenderView game page

A TIC-80 shooter in fewer than 560 characters of source code
Submitted by JimOfLeisure — 5 days, 19 hours before the deadline
Add to collection

Play game

Virus Defender's itch.io page

How many characters of code did you use?
558

Include your code here, if you'd like to show it off!
a=math b=240 c=138 d=120 e=69 f=0 g=0 h=0 i=.5 j=.2 k=.5 function l()m=d n=e o=0 p=0 q=0 r=0 end l() function TIC()t=a.sin(a.rad(f))u=-a.cos(a.rad(f))m=m+o n=n+p q=q+i r=r+j if btnp(4)then m=d+t*9 n=e+u*9 o=t*2 p=u*2 end if btn(2)then f=f-4 end if btn(3)then f=f+4 end cls()circ(d,e,7,8)print("*",(q-6)%b,(r-4)%c,6,true,2)circ(q%b,r%c,2,6) if pix(m%b,n%c)==6 then g=g+1 k=k*1.2 i=k*t j=k*u l()end print("SCORE "..g.." HI "..h,9,0)pix(m%b,n%c,15)line(d,e,d+t*9,e+u*9,15) if a.abs(q%b-d)<9 and a.abs(r%c-e)<9 then h=g>h and g or h g=0 k=.5 i=.5 j=.2 l()end end

Leave a comment

Log in with itch.io to leave a comment.

Comments

Developer (1 edit)

Formatted source. Note there are 3 ‘extra’ newlines, so this could have been 555 characters:

a=math b=240 c=138 d=120 e=69 f=0 g=0 h=0 i=.5 j=.2 k=.5
function l()m=d n=e o=0 p=0 q=0 r=0 end
l()
function TIC()t=a.sin(a.rad(f))u=-a.cos(a.rad(f))m=m+o n=n+p q=q+i r=r+j
if btnp(4)then m=d+t*9 n=e+u*9 o=t*2 p=u*2 end
if btn(2)then f=f-4 end
if btn(3)then f=f+4 end
cls()circ(d,e,7,8)print("*",(q-6)%b,(r-4)%c,6,true,2)circ(q%b,r%c,2,6)
if pix(m%b,n%c)==6 then g=g+1 k=k*1.2 i=k*t j=k*u l()end
print("SCORE "..g.." HI "..h,9,0)pix(m%b,n%c,15)line(d,e,d+t*9,e+u*9,15)
if a.abs(q%b-d)<9 and a.abs(r%c-e)<9 then h=g>h and g or h g=0 k=.5 i=.5 j=.2 l()end
end

And this is what it looks like with friendlier variables, spacing, and comments:

-- for extra manual minifying
m=math
screenwidth=240
screenheight=138
middlex=120
middley=69

-- starting turrent angle
angle=0

score=0
highscore=0
edx=.5
edy=.2
espeed=.5

function resetmovers()
-- init bullet x, y, dx, and dy (velocity)
    bx=middlex
    by=middley
    dx=0
    dy=0
    -- init enemy
    ex=0
    ey=0
end

resetmovers()

function TIC()
    x=m.sin(m.rad(angle))
    -- negating Y because screen coords
    --   and I want starting position up
    --   and 0 is shorter than 180
    --   only saving 1 char, though
    y=-m.cos(m.rad(angle))
    bx=bx+dx
    by=by+dy
    ex=ex+edx
    ey=ey+edy
    if btnp(4) then
        -- pew pew
        bx=middlex+x*9
        by=middley+y*9
        dx=x*2
        dy=y*2
    end
    if btn(2) then
        angle=angle-4
    end
    if btn(3) then
        angle=angle+4
    end
    cls()
    -- cell
    circ(middlex,middley,7,8)
    -- enemy
    print("*", (ex-6)%screenwidth, (ey-4)%screenheight, 6, true, 2)
    circ(ex%screenwidth,ey%screenheight,2,6)
    -- bullet hit detect
    if pix(bx%screenwidth,by%screenheight) == 6 then
        score = score + 1
        -- -- reset enemy
        espeed=espeed*1.2
        edx=espeed*x
        edy=espeed*y
        resetmovers()
    end
    -- score
    print("SCORE "..score.." HI "..highscore,9,0)
    -- bullet
    pix(bx%screenwidth,by%screenheight,15)
    -- turret
    line(middlex,middley,middlex+x*9,middley+y*9,15)
    if m.abs(ex%screenwidth-middlex)<9 and m.abs(ey%screenheight-middley)<9 then
        -- game over! man. game over!
        highscore = score > highscore and score or highscore
        score=0
        espeed=.5
        edx=.5
        edy=.2
        resetmovers()
    end
end

Edit: I could probably save some more characters by using radians instead of degrees. I meant to do that, but that was very early in the dev process and I forgot about it.