@@ -34,14 +34,16 @@ function projectile:update(dt) | |||||
shipIsHit = true | shipIsHit = true | ||||
sounds["close"]:stop() | sounds["close"]:stop() | ||||
sounds["boom"]:play() | sounds["boom"]:play() | ||||
sounds["boom"]:setVolume(1) | |||||
end | end | ||||
for i in ipairs(planets) do | for i in ipairs(planets) do | ||||
if planets[i].deletable == false then | if planets[i].deletable == false then | ||||
distanceToShip = math.sqrt((planets[i].x - self.x)^2 + (planets[i].y - self.y)^2) | distanceToShip = math.sqrt((planets[i].x - self.x)^2 + (planets[i].y - self.y)^2) | ||||
if distanceToShip < planets[i].w/4 then | if distanceToShip < planets[i].w/4 then | ||||
sounds["boom"]:play() | sounds["boom"]:play() | ||||
sounds["boom"]:setVolume(0.4) | |||||
local q = #explosions | 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 | explosions[q+1].type = 2 | ||||
table.remove(planets, i) | table.remove(planets, i) | ||||
self.killed = true | self.killed = true | ||||
@@ -41,6 +41,7 @@ function planet:update(dt) | |||||
shipIsHit = true | shipIsHit = true | ||||
sounds["close"]:stop() | sounds["close"]:stop() | ||||
sounds["boom"]:play() | sounds["boom"]:play() | ||||
sounds["boom"]:setVolume(1) | |||||
end | end | ||||
end | end | ||||
end | end | ||||
@@ -17,8 +17,10 @@ end | |||||
function explosion:update(dt) | function explosion:update(dt) | ||||
self.range = self.range + dt * 24 | self.range = self.range + dt * 24 | ||||
local maxRange = WINDOW_WIDTH*2 | local maxRange = WINDOW_WIDTH*2 | ||||
if self.type >= 1 then | |||||
if self.type == 1 then | |||||
maxRange = WINDOW_WIDTH*6 | maxRange = WINDOW_WIDTH*6 | ||||
elseif self.type == 2 then | |||||
maxRange = 200 | |||||
end | end | ||||
if self.range * self.v > maxRange then | if self.range * self.v > maxRange then | ||||
--print("killing myself with range" .. self.range) | --print("killing myself with range" .. self.range) | ||||
@@ -31,7 +33,10 @@ end | |||||
function explosion:render(toggle) | function explosion:render(toggle) | ||||
--print("rendering myself" .. self.x .. " " .. self.y .. " " .. self.range .. " " .. self.v) | --print("rendering myself" .. self.x .. " " .. self.y .. " " .. self.range .. " " .. self.v) | ||||
love.graphics.setColor(unpack(self.color)) | 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)) | love.graphics.setColor(1,1,1,0.7/(self.range/6)) | ||||
-- print(self.range) | -- print(self.range) | ||||
end | end | ||||
@@ -1,6 +1,15 @@ | |||||
level7 = Class{} | level7 = Class{} | ||||
local levelLoaded = false | local levelLoaded = false | ||||
local M = {} | 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() | function level7.load() | ||||
shipsleft = 1 | shipsleft = 1 | ||||
local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png") | local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png") | ||||
@@ -66,6 +75,7 @@ function level7.hint() | |||||
end | end | ||||
function level7.reset() | function level7.reset() | ||||
firstShip:reset() | firstShip:reset() | ||||
camera.scale = 1 | |||||
for i in ipairs(planets) do | for i in ipairs(planets) do | ||||
if not planets[i].deletable then | if not planets[i].deletable then | ||||
table.remove(planets, i) | table.remove(planets, i) | ||||
@@ -1,10 +1,10 @@ | |||||
sounds = { | sounds = { | ||||
["boom"] = love.audio.newSource("entities/planet/boom.wav", "static"), | ["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 = { | music = { | ||||
["menu"] = love.audio.newSource("entities/music/menu.ogg", "static"), | ["menu"] = love.audio.newSource("entities/music/menu.ogg", "static"), | ||||
@@ -20,7 +20,12 @@ function musicController(orders, toggling) | |||||
music["menu"]:setVolume(1) | music["menu"]:setVolume(1) | ||||
elseif gameStatus == 'play' then | elseif gameStatus == 'play' then | ||||
music["play"]:play() | 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) | music["menu"]:setVolume(1) | ||||
end | end | ||||
elseif orders == "mute" then | elseif orders == "mute" then | ||||