Przeglądaj źródła

Fixed bugs, added eraser highlight

master
Madiwka3 1 rok temu
rodzic
commit
68a4ee349a
6 zmienionych plików z 24 dodań i 5 usunięć
  1. +3
    -3
      entities/explosion/explosion.lua
  2. +1
    -0
      entities/planet/planet.lua
  3. +0
    -1
      levels/level1.lua
  4. +7
    -0
      main.lua
  5. +7
    -0
      src/GUI.lua
  6. +6
    -1
      src/stateMachine.lua

+ 3
- 3
entities/explosion/explosion.lua Wyświetl plik

@@ -39,10 +39,10 @@ function explosion:render(toggle)
love.graphics.setColor(unpack(self.color))
if self.type == 2 then
love.graphics.setColor(1,1,1,0.7/(self.range))
-- print(self.range)
-- print(self.range)
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
love.graphics.circle("fill", self.x, self.y, self.range * self.v, 100)
love.graphics.setColor(1,1,1,1)

+ 1
- 0
entities/planet/planet.lua Wyświetl plik

@@ -12,6 +12,7 @@ self.attractionY = 0
self.charge = 20
self.r = radius
self.w = img:getWidth()
self.removed = false
self.image = img
self.angle = 0
self.color = {1,1,1,1}


+ 0
- 1
levels/level1.lua Wyświetl plik

@@ -56,7 +56,6 @@ end
function level1.reset()
firstShip:reset()
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
shipIsHit = false
firstShip.fuel = 25


+ 7
- 0
main.lua Wyświetl plik

@@ -98,6 +98,7 @@ function love.draw()
simpleScale.set()
love.graphics.clear(30 / 255,30 / 255,30 / 255,1)
stateDraw()
showFPS()
simpleScale.unSet()
end

@@ -112,3 +113,9 @@ function objReset()
firstShip:reset()
planets = {}
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

+ 7
- 0
src/GUI.lua Wyświetl plik

@@ -185,6 +185,7 @@ function GUIDraw(mode)
love.graphics.draw(planetImage,mx,my,0, 0.3, 0.3, shipW/2, shipH/2)
if love.keyboard.mouseisReleased then
love.keyboard.mouseisReleased = false
print("placing planet" .. #planets)
table.insert(planets, planet(vmx, vmy, 100000000, 0.3, planetImage))
sounds["planet"]:stop()
sounds["planet"]:play()
@@ -247,6 +248,8 @@ function GUIDraw(mode)
end
if pressed and hot then
love.keyboard.mouseisReleased = false
pressed = false
print("removing planet" .. j .. "Planets left " .. #planets)
table.remove(planets, j)
planetsleft = planetsleft + 1
break
@@ -281,7 +284,11 @@ function GUIDraw(mode)

--REMOVE TOOL
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)
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
firstShip.destX = -9000
shipsleft = 1 end, 1, 1, {0,0,1,1}, 0)


+ 6
- 1
src/stateMachine.lua Wyświetl plik

@@ -1,7 +1,12 @@
state = require("levels/"..gameState)
loadedState = gameState
print("levels/"..gameState)
function stateUpdate(dt)
state = require("levels/"..gameState)
if gameState ~= loadedState then
state = require("levels/"..gameState)
loadedState = gameState
print("levels/"..gameState)
end
state.update(dt)
musicController("norm")
rpcManager()


Ładowanie…
Anuluj
Zapisz