@@ -39,10 +39,10 @@ function explosion:render(toggle) | |||||
love.graphics.setColor(unpack(self.color)) | love.graphics.setColor(unpack(self.color)) | ||||
if self.type == 2 then | if self.type == 2 then | ||||
love.graphics.setColor(1,1,1,0.7/(self.range)) | love.graphics.setColor(1,1,1,0.7/(self.range)) | ||||
-- print(self.range) | |||||
-- print(self.range) | |||||
elseif self.type == 1 then | elseif self.type == 1 then | ||||
love.graphics.setColor(1,1,1,0.7/(self.range/6)) | |||||
-- print(self.range) | |||||
love.graphics.setColor(1,1,1,0.01*(76.32-(self.range*2))) | |||||
--print(self.range) | |||||
end | end | ||||
love.graphics.circle("fill", self.x, self.y, self.range * self.v, 100) | love.graphics.circle("fill", self.x, self.y, self.range * self.v, 100) | ||||
love.graphics.setColor(1,1,1,1) | love.graphics.setColor(1,1,1,1) |
@@ -12,6 +12,7 @@ self.attractionY = 0 | |||||
self.charge = 20 | self.charge = 20 | ||||
self.r = radius | self.r = radius | ||||
self.w = img:getWidth() | self.w = img:getWidth() | ||||
self.removed = false | |||||
self.image = img | self.image = img | ||||
self.angle = 0 | self.angle = 0 | ||||
self.color = {1,1,1,1} | self.color = {1,1,1,1} | ||||
@@ -56,7 +56,6 @@ end | |||||
function level1.reset() | function level1.reset() | ||||
firstShip:reset() | firstShip:reset() | ||||
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") | ||||
table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage)) | |||||
shipsleft = 1 | shipsleft = 1 | ||||
shipIsHit = false | shipIsHit = false | ||||
firstShip.fuel = 25 | firstShip.fuel = 25 | ||||
@@ -98,6 +98,7 @@ function love.draw() | |||||
simpleScale.set() | simpleScale.set() | ||||
love.graphics.clear(30 / 255,30 / 255,30 / 255,1) | love.graphics.clear(30 / 255,30 / 255,30 / 255,1) | ||||
stateDraw() | stateDraw() | ||||
showFPS() | |||||
simpleScale.unSet() | simpleScale.unSet() | ||||
end | end | ||||
@@ -112,3 +113,9 @@ function objReset() | |||||
firstShip:reset() | firstShip:reset() | ||||
planets = {} | planets = {} | ||||
end | end | ||||
function showFPS() | |||||
love.graphics.setFont(smallfont) | |||||
love.graphics.setColor(1, 1, 1, 1) | |||||
love.graphics.print("FPS: "..tostring(love.timer.getFPS( )), 10, 10) | |||||
end |
@@ -185,6 +185,7 @@ function GUIDraw(mode) | |||||
love.graphics.draw(planetImage,mx,my,0, 0.3, 0.3, shipW/2, shipH/2) | love.graphics.draw(planetImage,mx,my,0, 0.3, 0.3, shipW/2, shipH/2) | ||||
if love.keyboard.mouseisReleased then | if love.keyboard.mouseisReleased then | ||||
love.keyboard.mouseisReleased = false | love.keyboard.mouseisReleased = false | ||||
print("placing planet" .. #planets) | |||||
table.insert(planets, planet(vmx, vmy, 100000000, 0.3, planetImage)) | table.insert(planets, planet(vmx, vmy, 100000000, 0.3, planetImage)) | ||||
sounds["planet"]:stop() | sounds["planet"]:stop() | ||||
sounds["planet"]:play() | sounds["planet"]:play() | ||||
@@ -247,6 +248,8 @@ function GUIDraw(mode) | |||||
end | end | ||||
if pressed and hot then | if pressed and hot then | ||||
love.keyboard.mouseisReleased = false | love.keyboard.mouseisReleased = false | ||||
pressed = false | |||||
print("removing planet" .. j .. "Planets left " .. #planets) | |||||
table.remove(planets, j) | table.remove(planets, j) | ||||
planetsleft = planetsleft + 1 | planetsleft = planetsleft + 1 | ||||
break | break | ||||
@@ -281,7 +284,11 @@ function GUIDraw(mode) | |||||
--REMOVE TOOL | --REMOVE TOOL | ||||
trashbin = love.graphics.newImage("entities/trashbin.png") | trashbin = love.graphics.newImage("entities/trashbin.png") | ||||
if selectedItem ~= "eraser" then | |||||
GUIButton("inf", trashbin, menuX + 60, menuY+WINDOW_HEIGHT*0.6, function() selectedItem = "eraser" end, 1, 1, {1,1,1,1}, 0) | GUIButton("inf", trashbin, menuX + 60, menuY+WINDOW_HEIGHT*0.6, function() selectedItem = "eraser" end, 1, 1, {1,1,1,1}, 0) | ||||
else | |||||
GUIButton("inf", trashbin, menuX + 60, menuY+WINDOW_HEIGHT*0.6, function() selectedItem = "none" end, 1, 1, {1,0,0,1}, 0) | |||||
end | |||||
GUIButton("clr", trashbin, menuX + 240, menuY+WINDOW_HEIGHT*0.6, function() for i in ipairs(planets) do if planets[i].deletable then planetsleft = planetsleft + 1 planets[i] = nil end end for i in ipairs(cannons) do if cannons[i].deletable then cannonsleft = cannonsleft + 1 cannons[i] = nil end end firstShip.x = -9000 | GUIButton("clr", trashbin, menuX + 240, menuY+WINDOW_HEIGHT*0.6, function() for i in ipairs(planets) do if planets[i].deletable then planetsleft = planetsleft + 1 planets[i] = nil end end for i in ipairs(cannons) do if cannons[i].deletable then cannonsleft = cannonsleft + 1 cannons[i] = nil end end firstShip.x = -9000 | ||||
firstShip.destX = -9000 | firstShip.destX = -9000 | ||||
shipsleft = 1 end, 1, 1, {0,0,1,1}, 0) | shipsleft = 1 end, 1, 1, {0,0,1,1}, 0) | ||||
@@ -1,7 +1,12 @@ | |||||
state = require("levels/"..gameState) | state = require("levels/"..gameState) | ||||
loadedState = gameState | |||||
print("levels/"..gameState) | print("levels/"..gameState) | ||||
function stateUpdate(dt) | function stateUpdate(dt) | ||||
state = require("levels/"..gameState) | |||||
if gameState ~= loadedState then | |||||
state = require("levels/"..gameState) | |||||
loadedState = gameState | |||||
print("levels/"..gameState) | |||||
end | |||||
state.update(dt) | state.update(dt) | ||||
musicController("norm") | musicController("norm") | ||||
rpcManager() | rpcManager() | ||||