diff options
| author | 1029chris <1029chris@gmail.com> | 2022-02-10 18:22:43 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2022-02-10 18:22:43 -0800 |
| commit | 3c5f4bf5106d93939c6441f4da70e7830b654a34 (patch) | |
| tree | 79908379d727029505b4f6fb94475fc952726be0 | |
| parent | 261d79999931657a25512c60e53fe322bbbf6f9a (diff) | |
LASERS!!!!!!!
| -rw-r--r-- | Sound Effects Index.txt | 6 | ||||
| -rw-r--r-- | bullets.lua | 66 | ||||
| -rw-r--r-- | enemies.lua | 9 | ||||
| -rw-r--r-- | pickups.lua | 4 | ||||
| -rw-r--r-- | update.lua | 1 | ||||
| -rw-r--r-- | waves.lua | 17 |
6 files changed, 94 insertions, 9 deletions
diff --git a/Sound Effects Index.txt b/Sound Effects Index.txt index 0f524ba..3224f13 100644 --- a/Sound Effects Index.txt +++ b/Sound Effects Index.txt @@ -21,9 +21,9 @@ 20 Circular Kill 21 Rocket Shoot 22 Rocket Thruster -23 -24 -25 +23 Laser Charge 1.5 Seconds +24 Laser Loop +25 Laser Finished 26 27 Light Respawn 28 Respawn diff --git a/bullets.lua b/bullets.lua index 5bcb91d..e96b06b 100644 --- a/bullets.lua +++ b/bullets.lua @@ -45,4 +45,70 @@ function addbullet(x, y, velx, vely, evil, sprite) end add(obj, bullet) +end + +function addlaser(x, y, r) + local laser = {} + + --lasers!!!!!!!!!!!!!!! + laser.x = x + laser.y = y + laser.r = r + laser.timer = 0 + laser.playingsound = false + + function laser.draw(laser) + if laser.timer > 1.5 then + local radius = (min(laser.timer*laser.r*0.7,laser.r)+sin(t()*6))-mid(0, laser.timer-3, laser.r)*laser.r + for i = -10, laser.x, 1 do + line(i, laser.y+radius*sin(t()*3+i/(10+laser.timer^3.5))*1.6, i, laser.y-radius*sin(t()*3+i/(10+laser.timer^3.5))*1.6, 14) + pset(i, laser.y+(cos(t()*1.5+i/50)+sin(i/4.32535+t())*2)*radius/1.8, 14) + end + circfill(laser.x, laser.y, radius, 14) + rectfill(-10, laser.y-radius, laser.x, laser.y+radius, 14) + circfill(laser.x, laser.y, radius*0.7, 11) + rectfill(-10, laser.y-radius*0.7, laser.x, laser.y+radius*0.7, 11) + circfill(laser.x, laser.y, radius*0.3, 7) + rectfill(-10, laser.y-radius*0.3, laser.x, laser.y+radius*0.3, 7) + else + circfill(laser.x, laser.y, laser.timer*4+sin(t()*8), 11) + circfill(laser.x, laser.y, laser.timer*2+sin(t()*8), 7) + for i = mid(-5, laser.x-laser.timer*laser.x,laser.x), laser.x, 1 do + pset(i, laser.y+sin(i/6.32535-t())*2, 11) + pset(i, laser.y+cos(t()*1.5+i/30)*laser.timer*2+sin(i/8.32535+t()), 14) + end + end + end + + function laser.collide(object) + if object.x < laser.x and laser.y+laser.r*2 > object.y+object.h and laser.y-laser.r*2 < object.y and object.inv < 0 then + object:shot() + end + end + + function laser.update(laser) + laser.timer += 1/60 + --collision detection after the warm up + if laser.timer > 1.5 and laser.timer < 4.2 then + if not laser.playingsound then + sfx(24) + laser.playingsound = true + end + shake = rnd(8)/laser.timer + foreach(players, laser.collide) + end + + --delete laser once its done + if laser.timer > 4 then + del(obj, laser) + sfx(24, -2) + sfx(25) + for i = 1, 16, 1 do + addcircle(rnd(laser.x), laser.y-laser.r/2+rnd(laser.r), -0.5, -0.5, rnd(3), rnd(2), rnd({11,14,7}), 0) + end + end + end + + add(obj, laser) + sfx(23) end
\ No newline at end of file diff --git a/enemies.lua b/enemies.lua index 006ba6c..c88b2d9 100644 --- a/enemies.lua +++ b/enemies.lua @@ -81,7 +81,7 @@ end --SHOOTER THAT SHOOTS BIG WALLS!!!!!! -function addwallshooter(x, shootup, health, speed, offset) +function addwallshooter(x, shootup, health, speed, offset, bulletspeed) local enemy = {} enemy.x = x enemy.y = 119 @@ -98,6 +98,7 @@ function addwallshooter(x, shootup, health, speed, offset) enemy.shootcooldown = 0 enemy.speed = speed enemy.shoottoggle = true + enemy.bulletspeed = bulletspeed or 1 function enemy.draw(enemy) if enemy.inv < 0 or ceil(enemy.inv*10%2) == 1 then @@ -128,17 +129,17 @@ function addwallshooter(x, shootup, health, speed, offset) enemy.inv -= 1/60 foreach(players, enemy.collide) if enemy.shootcooldown < 0 then - if (t()+enemy.offset)%1>0.5 then + if (t()+enemy.offset)%1>0.5/enemy.bulletspeed then if not enemy.shoottoggle then --implemented a toggle so that the sound effect for firing gets played only once. enemy.shoottoggle = true if enemy.x < 128 then sfx(18) end end - enemy.shootcooldown = 0.08 + enemy.shootcooldown = 0.08/enemy.bulletspeed local vely = -1 if shootup then vely = 1 end - addbullet(enemy.x, enemy.y, -speed, vely, true, 2) + addbullet(enemy.x, enemy.y, -enemy.speed, enemy.bulletspeed*vely, true, 2) else enemy.shoottoggle = false end diff --git a/pickups.lua b/pickups.lua index c5f8ea2..9c06ada 100644 --- a/pickups.lua +++ b/pickups.lua @@ -4,7 +4,7 @@ function randompickups.update() pickuptimer -= 1/60 if pickuptimer < 0 then pickuptimer = 10 - if rnd(100) > 90 then + if rnd(100) > 85 then addpickup(128, rnd(80)+20) end end @@ -17,7 +17,7 @@ function addpickup(x, y, type) local pickup = {} pickup.x = x pickup.y = y - pickup.type = type or rnd({"health", "fastshoot", "3shoot"}) + pickup.type = type or rnd({"health", "health", "fastshoot", "3shoot"}) pickup.sprite = 4 if (pickup.type == "fastshoot") then @@ -19,6 +19,7 @@ if not gamerunning and t() > 1 then if btn(4) then addplayer(18, 60, 16, 18) startgame() + addlaser(60,60,10) -- temp spawning laser on start!!!!! GET RID OF THIS!!!! elseif btn(5) then addplayer(18, 45, 16, 18) addplayer(18, 75, 32, 34) @@ -153,6 +153,23 @@ wave[9] = { end } +wave[10] = { + delay = 1, + start = function() + for i = 1, 3, 1 do + addwallshooter(128+i*65, true, 10, 0.4, 0, 0.68) + addwallshooter(133+i*65, false, 10, 0.4, 0, 0.68) + end + addballshooter(200, 56, 12, 0.2) + end, + everysecond = function() + end, + conditions = function() + if #enemies < 1 then return true else return false + end + end +} + --wave[currentwave].start() --music(0, 0, 3) |
