Browse Source

Fixed sound volume & added zoom-out feature

tags/8.1
Madiwka3 3 years ago
parent
commit
7087c2513d
15 changed files with 32 additions and 9 deletions
  1. +3
    -1
      entities/enemy/projectile.lua
  2. BIN
      entities/enemy/rlaunch.ogg
  3. BIN
      entities/enemy/rlaunch.wav
  4. BIN
      entities/planet/close.ogg
  5. BIN
      entities/planet/close.wav
  6. +1
    -0
      entities/planet/planet.lua
  7. BIN
      entities/planet/teleport.ogg
  8. BIN
      entities/planet/teleport.wav
  9. BIN
      entities/ship/Appear.ogg
  10. BIN
      entities/ship/Appear.wav
  11. BIN
      entities/ship/Finish.ogg
  12. BIN
      entities/ship/Finish.wav
  13. +7
    -2
      explosion.lua
  14. +10
    -0
      levels/level7.lua
  15. +11
    -6
      src/musicController.lua

+ 3
- 1
entities/enemy/projectile.lua View File

@@ -34,14 +34,16 @@ function projectile:update(dt)
shipIsHit = true
sounds["close"]:stop()
sounds["boom"]:play()
sounds["boom"]:setVolume(1)
end
for i in ipairs(planets) do
if planets[i].deletable == false then
distanceToShip = math.sqrt((planets[i].x - self.x)^2 + (planets[i].y - self.y)^2)
if distanceToShip < planets[i].w/4 then
sounds["boom"]:play()
sounds["boom"]:setVolume(0.4)
local q = #explosions
table.insert(explosions, explosion(self.x, self.y, 100, {1,1,1,1}))
table.insert(explosions, explosion(self.x, self.y, 10, {1,1,1,1}))
explosions[q+1].type = 2
table.remove(planets, i)
self.killed = true


BIN
entities/enemy/rlaunch.ogg View File


BIN
entities/enemy/rlaunch.wav View File


BIN
entities/planet/close.ogg View File


BIN
entities/planet/close.wav View File


+ 1
- 0
entities/planet/planet.lua View File

@@ -41,6 +41,7 @@ function planet:update(dt)
shipIsHit = true
sounds["close"]:stop()
sounds["boom"]:play()
sounds["boom"]:setVolume(1)
end
end
end


BIN
entities/planet/teleport.ogg View File


BIN
entities/planet/teleport.wav View File


BIN
entities/ship/Appear.ogg View File


BIN
entities/ship/Appear.wav View File


BIN
entities/ship/Finish.ogg View File


BIN
entities/ship/Finish.wav View File


+ 7
- 2
explosion.lua View File

@@ -17,8 +17,10 @@ end
function explosion:update(dt)
self.range = self.range + dt * 24
local maxRange = WINDOW_WIDTH*2
if self.type >= 1 then
if self.type == 1 then
maxRange = WINDOW_WIDTH*6
elseif self.type == 2 then
maxRange = 200
end
if self.range * self.v > maxRange then
--print("killing myself with range" .. self.range)
@@ -31,7 +33,10 @@ end
function explosion:render(toggle)
--print("rendering myself" .. self.x .. " " .. self.y .. " " .. self.range .. " " .. self.v)
love.graphics.setColor(unpack(self.color))
if toggle == "special" then
if self.type == 2 then
love.graphics.setColor(1,1,1,0.7/(self.range))
-- print(self.range)
elseif toggle == "special" then
love.graphics.setColor(1,1,1,0.7/(self.range/6))
-- print(self.range)
end


+ 10
- 0
levels/level7.lua View File

@@ -1,6 +1,15 @@
level7 = Class{}
local levelLoaded = false
local M = {}
function love.wheelmoved(x, y)
if gameStatus == "play" then
if y > 0 and camera.scale < 1 then
camera.scale = camera.scale + 0.1
elseif y < 0 and camera.scale > 0.5 then
camera.scale = camera.scale - 0.1
end
end
end
function level7.load()
shipsleft = 1
local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
@@ -66,6 +75,7 @@ function level7.hint()
end
function level7.reset()
firstShip:reset()
camera.scale = 1
for i in ipairs(planets) do
if not planets[i].deletable then
table.remove(planets, i)


+ 11
- 6
src/musicController.lua View File

@@ -1,10 +1,10 @@
sounds = {
["boom"] = love.audio.newSource("entities/planet/boom.wav", "static"),
["close"] = love.audio.newSource("entities/planet/close.wav", "static"),
["appear"] = love.audio.newSource("entities/ship/Appear.wav", "static"),
["finish"] = love.audio.newSource("entities/ship/Finish.wav", "static"),
["planet"] = love.audio.newSource("entities/planet/teleport.wav", "static"),
["launch"] = love.audio.newSource("entities/enemy/rlaunch.wav", "static")
["close"] = love.audio.newSource("entities/planet/close.ogg", "static"),
["appear"] = love.audio.newSource("entities/ship/Appear.ogg", "static"),
["finish"] = love.audio.newSource("entities/ship/Finish.ogg", "static"),
["planet"] = love.audio.newSource("entities/planet/teleport.ogg", "static"),
["launch"] = love.audio.newSource("entities/enemy/rlaunch.ogg", "static")
}
music = {
["menu"] = love.audio.newSource("entities/music/menu.ogg", "static"),
@@ -20,7 +20,12 @@ function musicController(orders, toggling)
music["menu"]:setVolume(1)
elseif gameStatus == 'play' then
music["play"]:play()
music["play"]:setVolume(0.4)
music["play"]:setVolume(0.8)
music["menu"]:setVolume(0.2)
elseif gameStatus == 'setup' then
music['menu']:play()
music["play"]:play()
music["play"]:setVolume(0.6)
music["menu"]:setVolume(1)
end
elseif orders == "mute" then


Loading…
Cancel
Save