0]']±>Sï}WÿÍuî…y8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3 680+TI then for i = 0,1 + kol do if math.random(0,1) == 1 then add_enemy(math.random(1,200),-30,wawes[Wawe][2+math.random(0,wawes[Wawe][1])]) else add_enemy(math.random(1,200),200,wawes[Wawe][2+math.random(0,wawes[Wawe][1])]) end end end end end function bez() if nop(2) then YSLOV=0 IMAGE=1 end end function init() health = 2 BO = 1 musicplaying = false BOR = 12 ap = 0 kol = 0 Wawe = 1 Kill = 0 TIME = 0 wawes = { {0,'def',k = 10}, {1,'def','thun',k = 50}, {1,'def','thun',k = 80}, {2,'def','thun','strel',k = 100}, {1,'boss',k = 1} } score = 0 pl={ s_raz = 15, s_speed = 2, s_freq = 200, x = 100, y = 100, mx,my,ml = mouse(), vx = 0, vy = 0 } part = {} ene = {} ss = {} apg = {} end function add_part(x,y,c) local el = { vx = math.random(-100,100) / 10, vy = math.random(-100,100) / 10, x = x, y = y, c = 5 } if math. abs(el.vx + el.vy) < 0.8 then el.vx = 0.5 el.vy = 2 end table.insert(part,el) end function BLOOD() for i,v in pairs(part) do pix(v.x,v.y,v.c) v.x = v.x + v.vx v.y = v.y + v.vy if math.abs(v.x + v.y)>300 then table.remove(part,i) end end end function add_apg(x,y) a = { x = x, y = y, img = 32 } table.insert(apg,a) end function bonus() if pl.s_freq<50 then pl.s_freq=45 end for i,v in pairs(apg) do local T = math.random(0,6) if collision(v.x,v.y,pl.x,pl.y,8) then table.remove(apg,i) ap = ap + 1 if T > 2 then if pl.s_freq<50 then pl.s_speed=pl.s_speed+1 else pl.s_freq = pl.s_freq - 50 end elseif T < 2 then pl.s_speed = pl.s_speed + 1 pl.s_freq = pl.s_freq - 20 end end v.img = anim(v.img,32) spr(v.img,v.x,v.y,0) end end function add_enemy(x,y,type) local img = 0 local hp = 0 if type == 'boss' then img = 22 hp = 67 end if type == 'def' then img = 16 hp = 1 end if type == 'strel' then img = 20 hp = 1 end if type == 'thun' then img = 18 hp = 1 end e = { x = x, y = y, type = type, vx = 0, vy = 0, img = img, con = img, hp = hp } table.insert(ene,e) end function enem() for i,v in pairs(ene) do if v.hp < 0 then BOR = 2 if rand(0,1) == 1 then sfx(5,40+rand(0,5),20,3) else sfx(5,50,2,3) end for i = 0,190 do add_part(v.x,v.y,2) end Kill = Kill + 1 score = score + 20 table.remove(ene,i) end v.x = v.x + v.vx v.y = v.y + v.vy if v.type == "def" then if (time()%600)>580+TI then v.vx = math.random(-5,5)/50 v.vy = math.random(-5,5)/20 end end if v.type == "boss" then if math.random(0,2200) < 1100 then v.vy = 1 else v.vy = -1 end v.vx = 0 if time()%700>680+TI then if v.x>10 then sfx(6,59,20,3) end for i =0,7 do shoot(v.x,v.y,pl.x,pl.y+i*3,'pl',2,4) end end end if v.type == "thun" then v.vx,v.vy = vector(v.x,v.y,pl.x,pl.y) v.vx = v.vx/2 + math.random(-1,1)/10 v.vy = v.vy/2 + math.random(-1,1)/2 end if v.type == "strel" then if (time()%1000)>980+TI then v.vx = math.random(-10,10)/100 v.vy = math.random(-10,10)/100 end if (time()%8000)>7980+TI then shoot(v.x,v.y,pl.x+math.random(-1,1),pl.y+math.random(-1,1),"pl",0.5,0) end end if v.xEX1 then v.vx=-0.3 end if v.yEY1 then v.vy=-0.3 end if collision(v.x+2,v.y-1,pl.x,pl.y,8,10) and YSLOV == 0 then health=health-1 IMAGE=3 YSLOV = 1 end v.img = anim(v.img,v.con) spr(v.img,v.x,v.y,0) end end function vector(x,y,x1,y1) kat = math.sqrt((x1 - x)^2 + (y1 - y)^2) vx = (x1 - x)/kat vy = (y1 - y)/kat return vx,vy end function shoot(x,y,x1,y1,tar,speed,raz) vx,vy = vector(x,y,x1,y1) bull = { x = x, y = y, vx = vx + math.random(-20,20)/500, vy = vy + math.random(-20,20)/500, tar = tar, sp = speed, raz = raz } table.insert(ss, bull) end function draw_main() for i = 0,health do spr(49,i*9,0) end BOR = 12 rectb(EX,EY,EX1,EY1,13) spr(IMAGE, pl.x, pl.y,0) print(Wawe,210,4,12) print('/5',216,4,12) print('level',180,4,12) print(Kill,200,16,12) print(pl.s_speed,200,50) print(pl.s_freq,200,70) print(ap,200,80) print('fr',220,70) print('sp',220,50) end function collision(x,y,x1,y1,size) r = math.sqrt(math.abs(x1-(x))^2 + math.abs(y1-(y))^2) if r < size then return true end end function anim(img,con) if (time()%300>280+TI) then img = (img + 1)%2 + con end return img end function bullets() p = 0 for i,v in pairs(ss) do p = i print('o',v.x,v.y,12) if v.x>240 or v.y>136 or v.x<0 or v.y<0 then table.remove(ss,p) else v.x=v.x+v.vx * v.sp + math.random(v.raz-v.raz*2,v.raz)/10 v.y=v.y+v.vy * v.sp + math.random(v.raz-v.raz*2,v.raz)/10 if v.tar == "pl" then if collision(v.x,v.y,pl.x,pl.y,4) then POL = 1 end end if v.tar == "enem" then for e,ev in pairs(ene) do if collision(v.x,v.y,ev.x,ev.y,8) then table.remove(ss,i) ev.hp = ev.hp - 1 end end end end end end function rand(c,v) return math.random(c,v) end function nop(S) TIME = TIME + 1 if TIME > S * 50 then TIME = 0 return true end end function main() if YSLOV == 1 then bez() end if not musicplaying then musicplaying = true end if Wawe == 5 and Kill == 1 then if nop(7) then POL = 5 end end if health<0 then POL=1 end pl.mx, pl.my, lm = mouse() cls() if time()%9000>8980+TI then if rand(0,3) == 1 then kol = kol + 4 end if ap<11 then add_apg(rand(40,150),rand(40,100)) end end if key(19) and pl.y + pl.vy <= EY1 then pl.vy = 1 elseif key(23) and pl.y + pl.vy >= EY then pl.vy = -1 else pl.vy = 0 end if key(1) and pl.x + pl.vx >= EX then pl.vx = -1 elseif key(4) and pl.x + pl.vx <= EX1 then pl.vx = 1 else pl.vx = 0 end if lm and (time()%pl.s_freq)>pl.s_freq-20+TI then shoot(pl.x, pl.y, pl.mx, pl.my,"enem",pl.s_speed,pl.s_raz) end if Kill > wawes[Wawe].k then ene = {} Kill = 0 Wawe = Wawe + 1 end enem() bullets() pl.x = pl.x + pl.vx pl.y = pl.y + pl.vy draw_main() bonus() wawegen() BLOOD() end init() function menu() if time()%3000 > 2980 then for i = 1,40 do add_part(rand(1,200),rand(1,102),2) end end if keyp(26) then BB = 1 sfx(8,5) end cls() print('press z for start',75,100) BLOOD() font('ASSAULT',30,20,5,9,9,true,3) if BB == 1 and nop(2) then POL = 3 BB = 0 end end function tut() cls() spr(369,20,20,0,1,0,0,3,3) print('- move',50,24,12) spr(374,20,80,0,1,0,0,2,2) print(' - pew', 50,84,12) print('press z',100,100) if keyp(26) then BB = 1 end if BB == 1 and nop(3) then POL = 0 BB = 0 end end function TIC() if POL == 5 then cls() print('good!',0,0,12) if nop(5) then POL = 2 init() end end if POL == 3 then tut() end if POL == 2 then menu() end if POL == 0 then main() end if POL == 1 then cls() POL = 0 init() end end