diff options
| -rw-r--r-- | bullets.lua | 10 | ||||
| -rw-r--r-- | draw.lua | 8 | ||||
| -rw-r--r-- | enemies.lua | 123 | ||||
| -rw-r--r-- | objects.lua | 3 | ||||
| -rw-r--r-- | pickups.lua | 10 | ||||
| -rw-r--r-- | players.lua | 12 | ||||
| -rw-r--r-- | ui.lua | 50 | ||||
| -rw-r--r-- | update.lua | 3 | ||||
| -rw-r--r-- | waves.lua | 34 |
9 files changed, 125 insertions, 128 deletions
diff --git a/bullets.lua b/bullets.lua index 461ee15..ffb7fb9 100644 --- a/bullets.lua +++ b/bullets.lua @@ -7,7 +7,7 @@ function addbullet(x, y, velx, vely, good, sprite) sprite = sprite or 2 good = good or false - function bullet.draw(bullet) + function bullet.draw() spr(sprite, x, y) end @@ -26,7 +26,7 @@ function addbullet(x, y, velx, vely, good, sprite) end end - function bullet.update(bullet) + function bullet.update() --applying velocity x += velx y += vely @@ -85,7 +85,7 @@ function addlaser(x, y, r, enemy) end end - function laser.update(laser) + function laser.update() timer += ft --collision detection after the warm up if timer > 1.5 and timer < 3.6 then @@ -127,7 +127,7 @@ function addmissile(x, y, target) --basic small weak enemy collide = enemycollide } - function enemy.draw(enemy) + function enemy.draw() if enemy.inv < 0 or ceil(enemy.inv*10%2) == 1 then spr(42, enemy.x, enemy.y, 2, 1) end @@ -140,7 +140,7 @@ function addmissile(x, y, target) --basic small weak enemy addcircle(enemy.x+12, enemy.y+rnd(8), 0, rnd()/8, 2.1, 0.6, rnd({9,5})) enemymisc(enemy) if enemy.health <= 0 then -- die!!!!! - enemydie(enemy,17,2,10) + enemydie(enemy,17,2,17) end end @@ -1,7 +1,7 @@ --pallete replacement pal({1,2,131,141,5,6,7,136,9,137,139,12,133,3,140,130}, 1) --don't ask me why, but this table of colors starts at 1, and 0 is the final color -- pal(15,140,1) --- pal(14,3,1) --5 tokens +-- pal(14,3,1) -- pal(13,133,1) -- pal(11,139,1) -- pal(10,137,1) @@ -21,11 +21,11 @@ if gamerunning then runningscore(currentscore,true) else runningscore(currentscore,false) - local textcolors = {{12,15},{9,2}} + scoretextcolors = {{12,15},{2,9}} --shows incorrect shadow colour for 2P counter (shows as 0) for i = 1, #players, 1 do - local player = players[i] + player = players[i] if player.health < 1 then - printdropshadow(ceil(player.inv),player.x+circletimex,player.y+circletimey,textcolors[i][i],textcolors[i][i+1]) + printdropshadow(ceil(player.inv),player.x+circletimex,player.y+circletimey,scoretextcolors[i][i],scoretextcolors[i][i+1]) end end end diff --git a/enemies.lua b/enemies.lua index e7c35b9..b997c3b 100644 --- a/enemies.lua +++ b/enemies.lua @@ -86,8 +86,8 @@ function addbasicenemy(x, y, speed) --basic small weak enemy collide = enemycollide } - function enemy.draw(enemy) - local sprite = enemy.sprite + function enemy.draw() + sprite = enemy.sprite if flr(sin(time()*speed)) ~= 0 then --if the ships heading up, change sprite sprite += 1 end @@ -113,9 +113,9 @@ function addbasicenemy(x, y, speed) --basic small weak enemy add(enemies, enemy) end ---SHOOTER THAT SHOOTS BIG WALLS!!!!!! -function addwallshooter(x, shootup, health, speed, offset, bulletspeed) +--SHOOTER THAT SHOOTS BIG WALLS!!!!!! +function addwallshooter(x, shootup, speed, offset, bulletspeed) local enemy = { x = x, y = 119, @@ -124,9 +124,9 @@ function addwallshooter(x, shootup, health, speed, offset, bulletspeed) w = 8, h = 8, inv = -1, - health = health, + health = 10, --10 shootcooldown = 0, - speed = speed, + -- speed = speed, shoottoggle = true, bulletspeed = bulletspeed or 1, shot = enemyshot, @@ -137,10 +137,8 @@ function addwallshooter(x, shootup, health, speed, offset, bulletspeed) enemy.sprite = 44 end - function enemy.draw(enemy) - if enemy.health < health*0.25 then - damagesmoke(enemy) - end + function enemy.draw() + if enemy.health < 3 then damagesmoke(enemy) end if enemy.inv < 0 or flashtime then spr(enemy.sprite+t()*10%2, enemy.x, enemy.y) end @@ -151,10 +149,10 @@ function addwallshooter(x, shootup, health, speed, offset, bulletspeed) if enemy.shootcooldown < 0 then if (t()+enemy.offset)%1>0.5/enemy.bulletspeed then enemy.shootcooldown = 0.08/enemy.bulletspeed - local vely = -1 - if shootup then vely = 1 end + velywall = -1 + if shootup then velywall = 1 end if enemy.x < 120 and enemy.x > 20 then - addbullet(enemy.x, enemy.y, -enemy.speed, enemy.bulletspeed*vely) + addbullet(enemy.x, enemy.y, -speed, enemy.bulletspeed*velywall) if not enemy.shoottoggle then --implemented a toggle so that the sound effect for firing gets played only once. enemy.shoottoggle = true sfx(18, 3) @@ -188,9 +186,9 @@ function addballshooter(x, y, speed) collide = enemycollide } - function enemy.draw(enemy) + function enemy.draw() if enemy.inv < 0 or flashtime then - local sprite = 11 + sprite = 11 if enemy.health < 4 then damagesmoke(enemy) sprite = 27 @@ -235,7 +233,7 @@ function addtargetingenemy(x, y, speed) collide = enemycollide } - function enemy.draw(enemy) + function enemy.draw() if enemy.health < 2 then damagesmoke(enemy) end @@ -249,12 +247,12 @@ function addtargetingenemy(x, y, speed) if enemy.shootcooldown < 0 and currentwavetime%1.5>1.2 then enemy.shootcooldown = 0.1 enemy.bulletcounter += 1 - local p = enemy.bulletcounter%#players+1 - if enemy.x < canshootatx and players[p].x < enemy.x+30 then --math involving a distance check to get the proper velocity for aiming - local distance = sqrt((players[p].x - enemy.x)^2+(players[p].y - enemy.y)^2) - local velx = (players[p].x - enemy.x)/distance - local vely = (players[p].y - enemy.y)/distance - addbullet(enemy.x-3, enemy.y, velx, vely) -- shoot if on screen + ptarget = enemy.bulletcounter%#players+1 + if enemy.x < canshootatx and players[ptarget].x < enemy.x+30 then --math involving a distance check to get the proper velocity for aiming + distancetarget = sqrt((players[ptarget].x - enemy.x)^2+(players[ptarget].y - enemy.y)^2) + velxtarget = (players[ptarget].x - enemy.x)/distancetarget + velytarget = (players[ptarget].y - enemy.y)/distancetarget + addbullet(enemy.x-3, enemy.y, velxtarget, velytarget) -- shoot if on screen sfx(15, 2) -- play shoot sound if on screen end end @@ -287,7 +285,7 @@ function addlasershooter(x, y, points, speed, stay, isboss) function enemy:draw() if enemy.inv < 0 or flashtime then - local sprite = 64 + sprite = 64 if enemy.health < 10 then damagesmoke(enemy) sprite = 96 @@ -366,25 +364,25 @@ function addwallboss(x, y, length, points, speed, stay, move, isboss) enemy.bulletfired[i] = 0 end - function enemy.draw(enemy) - local x,y = enemy.x,enemy.y - local dmg = 0 + function enemy.draw() + x,y = enemy.x,enemy.y + dmgwall = 0 if enemy.health < enemy.starthealth*0.25 then damagesmoke(enemy) - dmg = 32 + dmgwall = 32 end if enemy.inv < 0 or flashtime then for i = 2, length-1, 1 do - spr(93+enemy.bulletfired[i]+dmg, x, -8+y+i*8) + spr(93+enemy.bulletfired[i]+dmgwall, x, -8+y+i*8) if i < length-2 then - spr(79+((i%3)%2*16)+dmg, x+8, -8+y+i*8, 1, 1, false, (i%3 == 2)) + spr(79+((i%3)%2*16)+dmgwall, x+8, -8+y+i*8, 1, 1, false, (i%3 == 2)) end end - spr(77+enemy.bulletfired[1]+dmg, x, y) - spr(77+enemy.bulletfired[1]+dmg, x, y+length*8-8, 1, 1, false, true) - spr(70+dmg,x+8,y,2,2) - spr(70+dmg,x+8,y+length*8-16,2,2,false,true) - spr(79+dmg,x+8,y+length*8-24,1,1, false, true) + spr(77+enemy.bulletfired[1]+dmgwall, x, y) + spr(77+enemy.bulletfired[1]+dmgwall, x, y+length*8-8, 1, 1, false, true) + spr(70+dmgwall,x+8,y,2,2) + spr(70+dmgwall,x+8,y+length*8-16,2,2,false,true) + spr(79+dmgwall,x+8,y+length*8-24,1,1, false, true) end end @@ -453,11 +451,11 @@ function addbomb(x, y, delay) --BIG BOMB!!!! KILL IIT QUICKLY!!!! shot = enemyshot, collide = enemycollide } - local points = 50 --points by default if killed by player + pointsbomb = 50 --points by default if killed by player - function enemy.draw(enemy) - local x,y = enemy.x,enemy.y - local sprite = 73 + function enemy.draw() + x,y = enemy.x,enemy.y + sprite = 73 if everysecondtimer > 0.5 then sprite = 75 end --animation if enemy.health < 7 then damagesmoke(enemy) @@ -465,11 +463,11 @@ function addbomb(x, y, delay) --BIG BOMB!!!! KILL IIT QUICKLY!!!! end if enemy.inv < 0 or flashtime then circfill(x+15, y+16, sin(enemy.shootcooldown^2)*3-enemy.shootcooldown, rnd({7,11,3})) - local offset = mid(0, -enemy.shootcooldown-2, 3) - spr(sprite, x, y-offset, 2, 2) - spr(sprite, x, y+16+offset, 2, 2, false, true) - spr(sprite, x+15, y-offset, 2, 2, true) - spr(sprite, x+15, y+16+offset, 2, 2, true, true) + offsetbomb = mid(0, -enemy.shootcooldown-2, 3) + spr(sprite, x, y-offsetbomb, 2, 2) + spr(sprite, x, y+16+offsetbomb, 2, 2, false, true) + spr(sprite, x+15, y-offsetbomb, 2, 2, true) + spr(sprite, x+15, y+16+offsetbomb, 2, 2, true, true) end end @@ -479,7 +477,7 @@ function addbomb(x, y, delay) --BIG BOMB!!!! KILL IIT QUICKLY!!!! for i = 1, 60, 1 do addbullet(enemy.x+16, enemy.y+16, sin(i/60), cos(i/60)) enemy.health = 0 - points = -40 --loss of points + pointsbomb = -40 --loss of points sfx(19,2) sfx(8,-2) end @@ -487,7 +485,7 @@ function addbomb(x, y, delay) --BIG BOMB!!!! KILL IIT QUICKLY!!!! enemy.x = lerp(enemy.x, 80, 0.02) end enemymisc(enemy) - enemydie(enemy,20,3,points) --die bastard!!!!!! + enemydie(enemy,20,3,pointsbomb) --die bastard!!!!!! --charge sound if enemy.x < 120 and everysecondtimer > 0.45 then if enemy.shootcooldown < -5 then @@ -502,7 +500,6 @@ function addbomb(x, y, delay) --BIG BOMB!!!! KILL IIT QUICKLY!!!! end ---move enemy more towards the centre of the screen to have room for portal function addmissileboss(x, y) --boss that shoots missiles!!! local enemy = { x = x, @@ -520,8 +517,8 @@ function addmissileboss(x, y) --boss that shoots missiles!!! collide = enemycollide } - function enemy.draw(enemy) - local sprite = 68 + function enemy.draw() + sprite = 68 if enemy.health < 11 then sprite = 100 damagesmoke(enemy) @@ -533,7 +530,7 @@ function addmissileboss(x, y) --boss that shoots missiles!!! end function enemy.update() - local playertarget = ceil((t()/2.4)%#players) + playertarget = ceil((t()/2.4)%#players) enemy.targetchangetimer -= ft --some cool different moves, shout out to dont get a virus fans! if currentwavetime%18 > 8 and currentwavetime%20 < 12 then @@ -553,9 +550,9 @@ function addmissileboss(x, y) --boss that shoots missiles!!! if enemy.shootcooldown < 0 then enemy.shootcooldown = 0.3 + rnd(1.2) if enemy.x < canshootatx and players[playertarget] ~= nil then - local offset = 2 - if currentwavetime%2 > 1 then offset = 30 end - addmissile(enemy.x, enemy.y+offset, playertarget) + offsetmissleboss = 2 + if currentwavetime%2 > 1 then offsetmissleboss = 30 end + addmissile(enemy.x, enemy.y+offsetmissleboss, playertarget) if enemy.health < 11 then sfx(15, 2) addbullet(enemy.x,enemy.y+16,(players[playertarget].x-enemy.x)/70,(players[playertarget].y-enemy.y-16)/70) @@ -590,10 +587,10 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! --thrusters that each fall off once the portal's health is 1/5th depleated function addportalthruster(x,y,id,isflipped) if id*40-40 < enemy.health then - local sprite = 128 + spritethruster = 128 isflipped = isflipped or 1 - if flashtime then sprite = 132 end --animation - spr(sprite, x, isflipped*(sin(time()*enemy.speed)*3.5)+y, 4, 2) + if flashtime then spritethruster = 132 end --animation + spr(spritethruster, x, isflipped*(sin(time()*enemy.speed)*3.5)+y, 4, 2) elseif rnd() < 0.4 then addcircle(x+20+rnd(4), y+rnd(6), -0.5, rnd(0.5)-0.25, rnd(7), 1.4, rnd({5,9})) end @@ -602,11 +599,11 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! function enemy:draw() -- portal local x,y,speed,amount = enemy.x-8,10+sin(time()*enemy.speed+0.2)*2,enemy.speed,enemy.amount - local ovaly1 = (sin(time()*speed-0.12)*amount/2)+y+24 + ovaly1 = (sin(time()*speed-0.12)*amount/2)+y+24 --local ovaly2 = (-sin(time()*speed-0.12)*amount/2)+y+84 - local ovaly2 = -ovaly1+128 + ovaly2 = -ovaly1+128 ovalfill(x+28,ovaly1,x+6,ovaly2,14) - local portalcolors = {11,3} + portalcolors = {11,3} for i = 1, 260, 1 do --cool swirling portal effect pset(x+17+sin(i/53.3465+t()/8)*i/24+sin(i/350.23548+t()), y+54+cos(i/53.3465+t()/8)*i/9,portalcolors[(ceil(i/20))%#portalcolors+1]) end @@ -614,10 +611,10 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! oval(x+28,ovaly1,x+6,ovaly2,11) addportalthruster(x-19,y-4,3) addportalthruster(x-19,y+97,4,-1) - local sprite = 136 - if enemy.health < 40 then sprite = 140 end - spr(sprite, x, (sin(time()*speed)*amount)+y, 4, 3) - spr(sprite, x, (-sin(time()*speed)*amount)+y+85, 4, 3, false,true) + spriteportal = 136 + if enemy.health < 40 then spriteportal = 140 end + spr(spriteportal, x, (sin(time()*speed)*amount)+y, 4, 3) + spr(spriteportal, x, (-sin(time()*speed)*amount)+y+85, 4, 3, false,true) addportalthruster(x+6,y-4,1) addportalthruster(x+6,y+97,2,-1) clip(0,0,x+17,128) @@ -655,7 +652,7 @@ function addfinalboss() --THE FINAL BOSS!!!!!!! WOOOAAAHHHHHH!!!!!!!!!!!!!!!!!!! end, function() for i = 1, 7, 1 do - addwallshooter(100 + (54-i)*i, (i%2==1), 10, 0.4) + addwallshooter(100 + (54-i)*i, (i%2==1), 0.4) end addlasershooter(128,48,100,0.2,false,false) addbomb(128, 48, 9) diff --git a/objects.lua b/objects.lua index ccfd052..84c248c 100644 --- a/objects.lua +++ b/objects.lua @@ -13,14 +13,13 @@ cartdata("toxicinvaders_bychrisandribbon") highscore0 = dget(0) --scores (0 is solo - 1 is coop) highscore1 = dget(1) currentscore = 0 --used for both gamemodes, but passed into highscore at end of game --- babymode = false --makes game a lot easier function startgame() music(0, 0, 3) wave[currentwave].start() gamerunning = true - print(gt,10,10) + -- print(gt,10,10) end function updateobjs() diff --git a/pickups.lua b/pickups.lua index d43984b..41fa66c 100644 --- a/pickups.lua +++ b/pickups.lua @@ -20,7 +20,7 @@ function addpickup(x, y, type) type = type or rnd({"fastshoot", "3shoot"}) function pickup.draw(pickup) - local sprite = 4 --had to move these checks into draw or they'd have incorrect sprites + local sprite = 4 --health if type == "fastshoot" then sprite = 20 elseif type == "3shoot" then @@ -38,18 +38,18 @@ function addpickup(x, y, type) end function pickup:affect(player) - local color = 8 + pickupcolor = 8 --health if type == "fastshoot" then player.shootspeed = 0.17 - color = 12 + pickupcolor = 12 elseif type == "3shoot" then player.shoot3 = true - color = 9 + pickupcolor = 9 else player.health = 3 end for i = 1, 8, 1 do - addcircle(x, y, sin(i/8), cos(i/8), 2, 0.6, color) + addcircle(x, y, sin(i/8), cos(i/8), 2, 0.6, pickupcolor) end currentscore+=10 --10 points sfx(30, 1) diff --git a/players.lua b/players.lua index a2c1c3c..28ec9bb 100644 --- a/players.lua +++ b/players.lua @@ -3,7 +3,7 @@ players = {} function addplayer(x, y, sprite, bulletsprite) local player = { - health = 3, + health = 33, --3 x = x, y = y, w = 8, @@ -93,10 +93,14 @@ function addplayer(x, y, sprite, bulletsprite) --particles from rockets, and smoke/sparks from damage player.particlecooldown -= ft if player.particlecooldown < 0 and player.health > 0 then - addcircle(player.x-1, player.y, -0.5, 0, 1.5, 0.5, 9) - addcircle(player.x-1, player.y+7, -0.5, 0, 1.5, 0.5, 9) + thrusteroffset = {0,7} + for i = 1, 2, 1 do + addcircle(player.x-1, player.y+thrusteroffset[i], -0.5, 0, 1.5, 0.5, 9) + end + -- addcircle(player.x-1, player.y, -0.5, 0, 1.5, 0.5, 9) + -- addcircle(player.x-1, player.y+7, -0.5, 0, 1.5, 0.5, 9) if player.health < 3 then - addcircle(player.x+rnd(8), player.y+rnd(8), rnd(1.5)-0.75, -1.5, 1, rnd(1)+0.5, 9, -0.1) + addcircle(player.x+rnd(8), player.y+rnd(8), rnd(1.5)-0.75, -1.5, 1, rnd(1)+0.5, rnd({9,10}), -0.1) if player.health < 2 then damagesmoke(player) end @@ -14,16 +14,14 @@ function invaderslogotext(x,y) -- x = 12 -- y = 20 - --font - local text = "I N V A D E R S" + invaderstext = "I N V A D E R S" for i = 1, 12, 1 do - print(text, x+i%3-1, y+i%4-1, 3) + print(invaderstext, x+i%3-1, y+i%4-1, 3) end - print(text,x,y,14) + print(invaderstext,x,y,14) clip(x, y, 63, 3) - print(text,x,y,11) + print(invaderstext,x,y,11) clip() - end function drawlogo(x,y) @@ -31,8 +29,6 @@ function drawlogo(x,y) -- x = 24 -- y = 26 - --this is a horrible way to draw the logo, but I'm doing it anyways. x3 - -- muahahahahahahaha!!!!!! sspr(88,88,16,8,x-3,y+2,32,16) --to shadow sspr(88,88,16,8,x-3,y,32,16) --to sspr(120,88,8,8,x+55,y+2,16,16) --ic shadow @@ -67,7 +63,7 @@ function titlehighscores(x,y) end function playerscore() - if #players > 1 then + if coopmode then printdropshadow(scorewithzeros(tostring(currentscore),4),2,121,9,4) --2P current score else printdropshadow(scorewithzeros(tostring(currentscore),4),2,2,12,15) --1P current score @@ -89,43 +85,40 @@ function credits(x,y) -- default vaues -- x = 10 -- y = 100 - local sintime = sin(t())*2 - local timemod = (t()%2<1) + sintimecredits = sin(t())*2 + timemodcredits = (t()%2<1) palt(2,true) palt(0,false) - spr(186,x-4,y+6+sintime,1,1,timemod) --duck - spr(184,x+104,y+6+-sintime,1,1,timemod) --bot + spr(186,x-4,y+6+sintimecredits,1,1,timemodcredits) --duck + spr(184,x+104,y+6+-sintimecredits,1,1,timemodcredits) --bot palt() printdropshadow("1029chris\nLUA TUNES",x+10,y+5,9,2) printdropshadow("ribboncable\nART SOUNDS",x+56,y+5,12,15) - -- printdropshadow("CODE TUNES",x+8,y+12,11,3) - -- printdropshadow("ART SOUNDS",x+58,y+12,11,3) end --Ending screen function finalscorescreen(x,y) - local playercolour0 = 12 - local playercolour1 = 15 - - printdropshadow("fINAL sCORE", x+41,y+22,6,5) - if #players > 1 then + playercolour0 = 12 + playercolour1 = 15 + if coopmode then playercolour0 = 9 playercolour1 = 2 end - if (#players > 1 and currentscore > highscore1) or (#players == 1 and currentscore > highscore0) then + poke(0x5f58, 0x9 | 0x4) --makes score BIG + printdropshadow("vICTORY!", x+32,y+18,6,5) + printdropshadow(scorewithzeros(tostring(currentscore),4),x+48+circletimex,y+50+circletimey,playercolour0,playercolour1) --2P high score + poke(0x5f58) + -- printdropshadow("fINAL sCORE", x+43,y+22,6,5) + + if (coopmode and currentscore > highscore1) or (not coopmode and currentscore > highscore0) then if flashtime then - printdropshadow("! new high score !", x+27,y+32,11,3) + printdropshadow("! new high score !", x+27,y+34,11,3) end end - - poke(0x5f58, 0x0 | 0x9 | 0x4) --makes score BIG - printdropshadow(scorewithzeros(tostring(currentscore),4),x+48+circletimex,y+50+circletimey,playercolour0,playercolour1) --2P high score - poke(0x5f58, 0) printdropshadow(" THANKS FOR PLAYING\nPRESS β β π
ΎοΈ TO RETRY", x+19,y+80,11,3) - -- printdropshadow("PRESS β β π
ΎοΈ TO RETRY", x+18,y+88,11,3) printdropshadow("MADE WITH β₯ IN VANCOUVER\n β 2022 β", x+14,y+113,9,2) -- printdropshadow("β 2022 β", x+42,y+118,11,3) @@ -148,5 +141,4 @@ sfx(0,3,3) --this creates menu items that allow players to turn off screenshake, or always fire the ships gun. doshake = true menuitem(1, "(\129) screenshake", function() doshake = not doshake end) -menuitem(2, "(\144) autofire", function() alwaysfire = not alwaysfire end) --- menuitem(3, "(\137) BABYMODE", function() babymode = true end)
\ No newline at end of file +menuitem(2, "(\144) autofire", function() alwaysfire = not alwaysfire end)
\ No newline at end of file @@ -6,6 +6,9 @@ circletimex = sin(t())*3 -- for elements that move in a circle (respawn timer) circletimey = cos(t())*3 screenshakex = sin(shake+t())*shake screenshakey = sin(shake+gt/2.1)*shake +if #players > 1 then + coopmode = true +end if gameover then scrollspeed = mid(-1/10,scrollspeed-1/3000,ft) @@ -5,6 +5,7 @@ delaytimer = 0 everysecondtimer = 0 checkpoint = 1 bossmusic = false +targetplayer = 1 --NOTE - slow BG during boss waves / make bosses their own checkpoint @@ -49,7 +50,7 @@ wave[3] = { wave[4] = { delay = 0, start = function() - addwallshooter(140, true, 10, 0.4) + addwallshooter(140, true, 0.4) addbasicenemy(128, 30, 0.5) addtargetingenemy(155, 60, 0.15) addbasicenemy(128, 90, 0.5) @@ -64,7 +65,7 @@ wave[5] = { delay = 2, start = function() for i = 1, 12, 1 do - addwallshooter(100 + (54-i)*i, (i%2==1), 10, 0.4) + addwallshooter(100 + (54-i)*i, (i%2==1), 0.4) end addpickup(490, 60, "health") end, @@ -117,8 +118,8 @@ wave[8] = { delay = 1, start = function() addballshooter(140, 56, 0.2) - addwallshooter(120, true, 10, 0.3) - addwallshooter(220, true, 10, 0.3) + addwallshooter(120, true, 0.3) + addwallshooter(220, true, 0.3) addbasicenemy(128, 30, 0.5) addbasicenemy(128, 110, 0.5) addbasicenemy(140, 30, 0.2) @@ -131,10 +132,10 @@ wave[9] = { start = function() addtargetingenemy(128,1,0.1) addtargetingenemy(262,60,0.2) - addwallshooter(138, true, 10, 0.4, 0) - addwallshooter(144, true, 10, 0.4, 0) - addwallshooter(185, false, 10, 0.4, 0) - addwallshooter(230, true, 10, 0.4) + addwallshooter(138, true, 0.4, 0) + addwallshooter(144, true, 0.4, 0) + addwallshooter(185, false, 0.4, 0) + addwallshooter(230, true, 0.4) addballshooter(230, 56, 0.2) end, conditions = function() @@ -161,8 +162,8 @@ wave[11] = { delay = 1, start = function() for i = 1, 3, 1 do - addwallshooter(128+i*65, true, 10, 0.4, 0, 0.68) - addwallshooter(128+i*65, false, 10, 0.4, 0, 0.68) + addwallshooter(128+i*65, true, 0.4, 0, 0.68) + addwallshooter(128+i*65, false, 0.4, 0, 0.68) end addballshooter(200, 56, 0.2) end, @@ -220,11 +221,11 @@ wave[16] = { end, everysecond = function () if flr(currentwavetime%6) == 5 and currentwavetime < 20 then - local y = 16 - if players[1].y > 64 then - y = 80 + ylaserpos = 16 + if players[targetplayer].y > 64 then + ylaserpos = 80 end - addlasershooter(128, y, 50, 0.1, false) + addlasershooter(128, ylaserpos, 50, 0.1, false) end end } @@ -272,9 +273,9 @@ wave[19] = { wave[20] = { delay = 3, start = function() - if #players == 1 and highscore0 < currentscore then + if not coopmode and highscore0 < currentscore then dset(0, currentscore) --set singleplayer score - elseif #players > 1 and highscore1 < currentscore then + elseif coopmode and highscore1 < currentscore then dset(1, currentscore) --set multiplayer score end end, @@ -285,6 +286,7 @@ wave[20] = { foreach(wave, function(wave) if not wave.conditions then wave.conditions = function() if #enemies < 1 then return true end end end end) --if there are no conditons for a wave, give them one. look at all those ends!!!! function updatewaves() + if coopmode then targetplayer = rnd({1,2}) end currentwavetime += ft everysecondtimer += ft if everysecondtimer >= 1 then |
