Преглед изворни кода

Fixed sound volume & added zoom-out feature

tags/8.1
Madiwka3 пре 3 година
родитељ
комит
7087c2513d
15 измењених фајлова са 32 додато и 9 уклоњено
  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 Прегледај датотеку

@@ -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 Прегледај датотеку


BIN
entities/enemy/rlaunch.wav Прегледај датотеку


BIN
entities/planet/close.ogg Прегледај датотеку


BIN
entities/planet/close.wav Прегледај датотеку


+ 1
- 0
entities/planet/planet.lua Прегледај датотеку

@@ -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 Прегледај датотеку


BIN
entities/planet/teleport.wav Прегледај датотеку


BIN
entities/ship/Appear.ogg Прегледај датотеку


BIN
entities/ship/Appear.wav Прегледај датотеку


BIN
entities/ship/Finish.ogg Прегледај датотеку


BIN
entities/ship/Finish.wav Прегледај датотеку


+ 7
- 2
explosion.lua Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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 Прегледај датотеку

@@ -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…
Откажи
Сачувај