0,]']>S}Wup8d%qy)6o;]AsVl P!Bu͛%d@@BhDDDDD"dvVev֫efVE3d@@BDDD, ,","""@LL@"""""",",,",,,,"",,""""pwpwwwwwwwwwpwwpwwwwwwPUPUUUUUUUUUPUUPUUUUUU  """""""" "" """""" @@DDDDDDDD@DD@DDDDDD@, " " " " """"""""""""""                      ,>_ocp  #$%%&&&&&&&&&&&&&&&&&&&&&&&&&    93101222233333333 3 33333333333493 1@0 12334445566666777777777778p@AABBBBBBBBBBBBBBBBBBBBBBBBBBB D,bbbbbbbbbbbb10DaLPT?       3 0D43 0D40D4 0D430D4 DDDADD3CD3C4 DADDDDAACD30D4 DDDDADDC4D40D4DDDADAA03D403D4DDADADAD0D43CD33CDCDCD3303DCDCDCD303CDCDCD33CDAAAA!!!!!!!!03D40D43DDDDDDDD""""""""""""""""0D40D4DDDDDDDD"""""""""""""""" 0D30D4 ADDADD!""!""!""!"" 3D4033 ADDADD!""!""!""!"" 0D4CD DDDD""""""""0D43CDDDDD""""""""333D4DAA!!!!043D433CDC4033CD3QqqCDCCD3UQUwqwwqwCD3334UUUUwwwwwwww3CD=D4 UUUUwwwwwwww0D4333 QUUqwwqww0D4=D4 QUUqwwqww 3D4=D4 UUwwww 0D3 =D43 UUwwww 0D43CD 0D4 CD3033CDC4CD=3D43CD 0D4D 0CD3CD C43 CD33CD03CD3CDCD0D43CD3 03D403D4 C4D40D4 CD30D4 CD393                          ,  ,"" ,"", ""  "" "" "" """"""""""        -- title: tichou -- author: commensalism -- desc: touhou tic recreation -- license: MIT License -- version: 0.1 -- script: lua local t = 0 local lt = 0 local scr = {w=116, h=136} scr.cx, scr.cy = scr.w/2, scr.h/2 local shots = {} local rad = math.pi/180 local plr = {x=scr.cx, y=scr.h-30, i=0, hp=5, bomb=3, 3} local hits = 0 local boss = {x=scr.cx, y=30, hp=500, maxhp=500, sc=1} local pshots = {} local function trf(a) return 2*math.abs(2 * ((a/45) - math.floor((a/45) + 0.5))) - 1 end local function shotA(x, y, a, s, sz, col, colb) local shot = {type="a", x=x, y=y, a=a, s=s, sz=sz, col=col, colb=colb, life=0} table.insert(shots, shot) return shot end local function shotB(x, y, xvel, yvel, sz, col, colb) local shot = {type="b", x=x, y=y, xvel=xvel, yvel=yvel, sz=sz, col=col, colb=colb, life=0} table.insert(shots, shot) return shot end local function pshotA(x, y, s) table.insert(pshots, {x=x, y=y, s=s, type="a", life=0}) end local function update_shots() for i, s in ipairs(shots) do if s.x < -20 or s.y < -20 or s.x > scr.w + 20 or s.y > scr.h + 20 then table.remove(shots, i) goto cont end if string.lower(s.type) == "a" then local dx = math.cos(s.a)*s.s local dy = math.sin(s.a)*s.s s.x = s.x + dx s.y = s.y + dy elseif string.lower(s.type) == "b" then s.x = s.x + s.xvel s.y = s.y + s.yvel end s.life = s.life + 1 ::cont:: end for i, s in ipairs(pshots) do if s.x < -20 or s.y < -20 or s.x > scr.w + 20 or s.y > scr.h + 20 then table.remove(pshots, i) goto cont end if s.type == string.lower("a") then s.y = s.y - s.s end s.life = s.life + 1 ::cont:: end end local function draw_shots() for i, s in ipairs(shots) do circ(s.x, s.y, s.sz, s.col) if s.colb ~= -1 then circb(s.x, s.y, s.sz, s.colb) end end for i, s in ipairs(pshots) do spr(7, s.x - 4, s.y - 4, 0) end end local function hit() plr.hp = plr.hp - 1 plr.bomb = 1 plr.i = 60 hits = hits + 1 plr.x = scr.cx plr.y = scr.h - 30 sfx(0, "C-4") end local function shot_coll() for i, s in ipairs(pshots) do if (s.x - boss.x)^2 + (s.y - boss.y)^2 <= 256 then boss.hp = boss.hp - 1 table.remove(pshots, i) end end if plr.i > 0 then return end for i, s in ipairs(shots) do if (s.x - plr.x)^2 + (s.y - plr.y)^2 <= s.sz^2 then hit() return end end end poke(0x3FF8, 1) local ang = 0 local axel = 0 local ln = 0 local lx = 0 local ly = 0 local gg = false --music(0) function TIC() if boss.hp <= 9 and boss.sc >= 5 then cls(12) poke(0x3FF8, 12) print("win", 121, 69, 13) print("win", 120, 68, 0) return elseif plr.hp < 0 then cls(12) poke(0x3FF8, 12) print("lose", 121, 69, 13) print("lose", 120, 68, 0) return end if boss.hp <= 0 and boss.sc < 5 then boss.sc = boss.sc + 1 shots = {} lt = 0 plr.hp = math.min(5, plr.hp + 1) plr.bomb = 3 boss.hp = boss.maxhp sfx(2, "C-4") end local foc = btn(6) or key(64) local spd = 1.5 local bombed = false if foc then spd = 1 end if btn(0) then plr.y = plr.y - spd end if btn(1) then plr.y = plr.y + spd end if btn(2) then plr.x = plr.x - spd end if btn(3) then plr.x = plr.x + spd end if btn(4) then pshotA(plr.x, plr.y, 20) if t % 10 == 0 then sfx(3, "B-8", 2, 1) end end if btnp(5) and plr.bomb > 0 then shots = {} boss.hp = boss.hp - 50 plr.bomb = plr.bomb - 1 sfx(1, "C-4") bombed = true end plr.x = math.min(math.max(plr.x, 0), scr.w) plr.y = math.min(math.max(plr.y, 0), scr.h) if plr.i > 0 then plr.i = plr.i - 1 end cls(0) if bombed then cls(12) end update_shots() shot_coll() spr(3, boss.x - 16, boss.y - 16, 0, 1, 0, 0, 4, 4) if plr.i > 0 then if t % 2 == 0 then spr(0, plr.x - 8, plr.y - 8, 0, 1, 0, 0, 2, 2) end else spr(0, plr.x - 8, plr.y - 8, 0, 1, 0, 0, 2, 2) end if foc then spr(2, plr.x-2, plr.y - 2, 0) circb(plr.x, plr.y, 10, 4) line(math.cos(t*rad)*15+plr.x, math.sin(t*rad)*15+plr.y, math.cos(t*rad)*25+plr.x, math.sin(t*rad)*25+plr.y, 4) line(math.cos((t+90)*rad)*15+plr.x, math.sin((t+90)*rad)*15+plr.y, math.cos((t+90)*rad)*25+plr.x, math.sin((t+90)*rad)*25+plr.y, 4) line(math.cos((t+180)*rad)*15+plr.x, math.sin((t+180)*rad)*15+plr.y, math.cos((t+180)*rad)*25+plr.x, math.sin((t+180)*rad)*25+plr.y, 4) line(math.cos((t-90)*rad)*15+plr.x, math.sin((t-90)*rad)*15+plr.y, math.cos((t-90)*rad)*25+plr.x, math.sin((t-90)*rad)*25+plr.y, 4) end if boss.sc == 1 then if t % 30 == 0 then local of = math.random()*360 for i = 0, 15 do shotA(boss.x, boss.y, (i*(360/16)+of)*rad, 1, 5, 10, 9) end end elseif boss.sc == 2 then if t % 30 == 0 then ln = math.random(45, 135) * rad end local shot = shotA(boss.x, boss.y, ln, 1, 3, 10, -1) shot.ba = ln for i, s in ipairs(shots) do --s.a = s.ba + math.sin(s.life * rad) * rad s.a = s.ba + trf(s.life) * rad * 50 end elseif boss.sc == 3 then if lt % 300 == 0 then shotB(boss.x, boss.y + 20, 0, 0, 15, 3, 2) end for i, s in ipairs(shots) do local len = math.sqrt((plr.x - s.x)^2 + (plr.y - s.y)^2) s.xvel = (plr.x - s.x)/len/5 s.yvel = (plr.y - s.y)/len/5 if s.life > 360 then for i = 0, 15 do shotA(s.x, s.y, (i*(360/16)+math.random()*360)*rad, 1, 5, 2, 1) end table.remove(shots, i) end end elseif boss.sc == 4 then for i, s in ipairs(shots) do if s.life > 180 then table.remove(shots, i) elseif s.life > 30 and lt > 300 then s.a = s.a + s.rand*rad if s.col == 4 then s.col = 10 s.colb = 9 end end end local shot if lt > 300 then shot = shotA(scr.cx, 30, ang*rad, 1, 2, 4, 3) else shot = shotA(scr.cx, 30, ang*rad, 1, 2, 5, 6) end shot.rand = math.random()*2-1 ang = ang + axel axel = axel + 0.1 elseif boss.sc == 5 then if lt % 300 == 0 then local len = math.sqrt((plr.x - boss.x)^2 + (plr.y - boss.y)^2) lx = (plr.x - boss.x)/len ly = (plr.y - boss.y)/len elseif lt % 300 == 120 then sfx(3, "B-8", 180, 2) elseif lt % 300 > 120 then shotB(boss.x, boss.y, lx*3, ly*3, 10, 15, -1) else line(boss.x, boss.y, boss.x + lx * 300, boss.y + ly * 300, 2) end if lt % 60 == 0 then for i = 0, 15 do shotA(boss.x, boss.y, (i*(360/16)+math.random()*360)*rad, 1, 5, 15, 2) end end for i, s in ipairs(shots) do if s.colb == -1 then s.sz = s.sz + 0.5 end end end draw_shots() rect(3, 3, boss.hp / boss.maxhp * (scr.w - 6), 2, 12) rect(scr.w, 0, 240 - scr.w, scr.h, 1) print("Hits: " .. hits, scr.w + 10, 10, 4) for i = 0, 5 do if plr.hp >= i then spr(11, scr.w + 10 + (i * 10), 20, 0) else spr(10, scr.w + 10 + (i * 10), 20, 0) end end for i = 1, 3 do if plr.bomb >= i then spr(9, scr.w + 10 + ((i - 1) * 10), 30, 0) else spr(8, scr.w + 10 + ((i - 1) * 10), 30, 0) end end lt = lt + 1 t = t + 1 end