From a12f063e7f759a4727c6b654140a8acaaa8746f8 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 18:20:48 +0200 Subject: Added missing argument to new newSource function --- not/MusicPlayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'not') diff --git a/not/MusicPlayer.lua b/not/MusicPlayer.lua index 17beda4..900df68 100644 --- a/not/MusicPlayer.lua +++ b/not/MusicPlayer.lua @@ -22,7 +22,7 @@ function MusicPlayer:setTrack (trackName) if self.tracks[trackName] then self.source = self.tracks[trackName] else - local source = love.audio.newSource("assets/music/" .. trackName) + local source = love.audio.newSource("assets/music/" .. trackName, "stream") source:setLooping(true) source:setVolume(.7) self.source = source -- cgit v1.1 From 517625861535f76f1dcb992fff76d23fe4239f7c Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 18:29:50 +0200 Subject: Replaced deprecated filesystem functions --- not/Settings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'not') diff --git a/not/Settings.lua b/not/Settings.lua index ca429eb..f4790b3 100644 --- a/not/Settings.lua +++ b/not/Settings.lua @@ -10,7 +10,7 @@ local function convertToNew (old) end local function filePrepare () - if not love.filesystem.exists("settings") then + if not love.filesystem.getInfo("settings") then local def = love.filesystem.newFile("settings.default") local new = love.filesystem.newFile("settings") new:open("w") def:open("r") -- cgit v1.1 From 6cef97b6e9ba6878607b1fff08e42ca19b79914f Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 18:53:31 +0200 Subject: Hopefully all uses of setColor now use values in <0,1> range --- not/Button.lua | 4 ++-- not/Header.lua | 2 +- not/Hero.lua | 4 ++-- not/Layer.lua | 2 +- not/PhysicalBody.lua | 10 +++++----- not/Ray.lua | 2 +- not/Selector.lua | 6 +++--- not/Sprite.lua | 2 +- not/World.lua | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) (limited to 'not') diff --git a/not/Button.lua b/not/Button.lua index 3493a84..72823d6 100644 --- a/not/Button.lua +++ b/not/Button.lua @@ -42,9 +42,9 @@ function Button:draw (scale) local quad = self.quads local sprite = self.sprite if self:isEnabled() then - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(140, 140, 140, 255) + love.graphics.setColor(.6, .6, .6, 1) end love.graphics.draw(sprite, quad.button.normal, x*scale, y*scale, 0, scale, scale) if self.focused then diff --git a/not/Header.lua b/not/Header.lua index 8b2ec0d..5579774 100644 --- a/not/Header.lua +++ b/not/Header.lua @@ -26,7 +26,7 @@ function Header:draw (scale) local angle = self:getBounce(2) local dy = self:getBounce()*4 local x,y = self:getPosition() - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.setFont(Bold) love.graphics.printf(string.upper(self.text),x*scale,(y+dy)*scale,400,"center",(angle*5)*math.pi/180,scale,scale,200,12) end diff --git a/not/Hero.lua b/not/Hero.lua index a97a2b1..14e32f1 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -175,7 +175,7 @@ end function Hero:drawTag () local x,y = self:getPosition() love.graphics.setFont(Font) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.printf(string.format("Player %d", math.abs(self.group)), math.floor(x), math.floor(y)-26 ,100,'center',0,1,1,50,0) end @@ -184,7 +184,7 @@ end function Hero:drawHUD (x,y,scale,elevation) -- hud displays only if player is alive if self.isAlive then - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(self.IMAGE_FRAME, self.QUAD_FRAME, (x)*scale, (y)*scale, 0, scale, scale) love.graphics.draw(self.portrait, (x+2)*scale, (y+3)*scale, 0, scale, scale) local dy = 30 * elevation diff --git a/not/Layer.lua b/not/Layer.lua index 14dac32..97257ed 100644 --- a/not/Layer.lua +++ b/not/Layer.lua @@ -38,7 +38,7 @@ function Layer:clear () end function Layer:draw () - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(self.canvas, nil, nil, nil, self.drawScale, self.drawScale) end diff --git a/not/PhysicalBody.lua b/not/PhysicalBody.lua index 5081836..df9992e 100644 --- a/not/PhysicalBody.lua +++ b/not/PhysicalBody.lua @@ -69,19 +69,19 @@ function PhysicalBody:draw (debug) local category = fixture:getCategory() -- TODO: Fixture drawing of PhysicalBodies could take activity into account in every case. if category == 1 then - love.graphics.setColor(255, 69, 0, 150) + love.graphics.setColor(1, .3, 0, .6) end if category == 2 then - love.graphics.setColor(137, 255, 0, 150) + love.graphics.setColor(.5, 1, 0, .6) end if category == 3 then - love.graphics.setColor(137, 0, 255, 50) + love.graphics.setColor(.5, 0, 1, .2) end if category == 4 then if self.body:isActive() then - love.graphics.setColor(255, 230, 0, 50) + love.graphics.setColor(1, .9, 0, .2) else - love.graphics.setColor(255, 230, 0, 10) + love.graphics.setColor(1, .9, 0, .04) end end local camera = self.world.camera diff --git a/not/Ray.lua b/not/Ray.lua index 4ae640a..c53199b 100644 --- a/not/Ray.lua +++ b/not/Ray.lua @@ -18,7 +18,7 @@ end -- TODO: Ray should use Camera boundaries just-in-case. -- TODO: Ray uses magic numbers. function Ray:draw () - love.graphics.setColor(255, 247, 228, 247) + love.graphics.setColor(1, .97, .89, .97) love.graphics.setLineStyle("rough") love.graphics.setLineWidth(self.delay*160) diff --git a/not/Selector.lua b/not/Selector.lua index 5536b44..3a30834 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -134,9 +134,9 @@ function Selector:draw (scale) boxType = "active" end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if not self:isUnique() then - love.graphics.setColor(120, 120, 120, 255) + love.graphics.setColor(.5, .5, .5, 1) end love.graphics.draw(self.atlas, self.quads[self:getShapeString()][boxType], x*scale, y*scale, 0, scale, scale) -- TODO: That is one way to draw icon for selected value. Find better one. See: `config/menus/host`. @@ -145,7 +145,7 @@ function Selector:draw (scale) love.graphics.draw(icon, (x+2)*scale, (y+3)*scale, 0, scale, scale) end - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if self.focused then local dy = (h-6)/2 diff --git a/not/Sprite.lua b/not/Sprite.lua index ec23eac..f1d1703 100644 --- a/not/Sprite.lua +++ b/not/Sprite.lua @@ -103,7 +103,7 @@ function Sprite:draw (debug) local draw_x = math.floor(x) if i and not self.hidden then - love.graphics.setColor(255,255,255,255) + love.graphics.setColor(1, 1, 1, 1) if q then love.graphics.draw(i, q, draw_x, draw_y, angle, scaleX, scaleY, self:getOffset()) else diff --git a/not/World.lua b/not/World.lua index a5854d4..cadb4fd 100644 --- a/not/World.lua +++ b/not/World.lua @@ -369,11 +369,11 @@ function World:draw () self.camera:push() self.camera:transform(getScale(), 1, love.graphics.getDimensions()) - love.graphics.setColor(130,130,130) + love.graphics.setColor(.5, .5, .5) love.graphics.line(ax,center.y,bx,center.y) love.graphics.line(center.x,ay,center.x,by) - love.graphics.setColor(200,200,200) + love.graphics.setColor(.78, .78, .78) love.graphics.line(ax,0,bx,0) love.graphics.line(0,ay,0,by) self.camera:pop() -- cgit v1.1 From 2e88eed328b7c561cbce8c3ae8faebc694a3983e Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 19:07:54 +0200 Subject: Changed values of colours in mask in newImage --- not/Sprite.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'not') diff --git a/not/Sprite.lua b/not/Sprite.lua index f1d1703..191a7f7 100644 --- a/not/Sprite.lua +++ b/not/Sprite.lua @@ -27,8 +27,8 @@ end function Sprite.newImage (path) local imagedata = love.image.newImageData(path) local transparency = function(x, y, r, g, b, a) - if (r == 0 and g == 128 and b == 64) or - (r == 0 and g == 240 and b == 6) then + if (r == 0 and g == 128/255 and b == 64/255) or + (r == 0 and g == 240/255 and b == 6/255) then a = 0 end return r, g, b, a -- cgit v1.1 From 6c487d44312dd96fb37825ea3fc7354f108fdfb6 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 19:10:14 +0200 Subject: Now uses getFixtures instead of deprecated getFixtureList --- not/Hero.lua | 2 +- not/PhysicalBody.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'not') diff --git a/not/Hero.lua b/not/Hero.lua index 14e32f1..3037837 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -114,7 +114,7 @@ function Hero:update (dt) -- Cooldown self.punchCooldown = self.punchCooldown - dt if not self.body:isDestroyed() then -- TODO: This is weird - for _,fixture in pairs(self.body:getFixtureList()) do -- TODO: getFixtures from `PhysicalBody` or similar. + for _,fixture in pairs(self.body:getFixtures()) do -- TODO: getFixtures from `PhysicalBody` or similar. if fixture:getUserData() ~= self then fixture:setUserData({fixture:getUserData()[1] - dt, fixture:getUserData()[2]}) if fixture:getUserData()[1] < 0 then diff --git a/not/PhysicalBody.lua b/not/PhysicalBody.lua index df9992e..0fb969f 100644 --- a/not/PhysicalBody.lua +++ b/not/PhysicalBody.lua @@ -65,7 +65,7 @@ end function PhysicalBody:draw (debug) PhysicalBody.__super.draw(self, debug) if debug then - for _,fixture in pairs(self.body:getFixtureList()) do + for _,fixture in pairs(self.body:getFixtures()) do local category = fixture:getCategory() -- TODO: Fixture drawing of PhysicalBodies could take activity into account in every case. if category == 1 then -- cgit v1.1 From 290d75dceb905217cb67fcb32e95dbeb45e27e3c Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 7 Apr 2018 19:23:14 +0200 Subject: Renamed setAnimationsList to setAnimations to follow love's naming convention --- not/CloudGenerator.lua | 2 +- not/Effect.lua | 2 +- not/Hero.lua | 2 +- not/Platform.lua | 2 +- not/Sprite.lua | 2 +- not/Trap.lua | 2 +- not/World.lua | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'not') diff --git a/not/CloudGenerator.lua b/not/CloudGenerator.lua index e72514b..62cac5c 100644 --- a/not/CloudGenerator.lua +++ b/not/CloudGenerator.lua @@ -17,7 +17,7 @@ end -- TODO: This was a bad idea. Move Cloud creation back to World, pass created Cloud here for configuration. function CloudGenerator:createCloud (x, y, style) local cloud = Cloud(x, y, self.world, self.atlas) - cloud:setAnimationsList(self.quads) + cloud:setAnimations(self.quads) cloud:setAnimation(style) cloud:setVelocity(13, 0) cloud:setBoundary(340, 320) diff --git a/not/Effect.lua b/not/Effect.lua index 6c0dad0..ebbfece 100644 --- a/not/Effect.lua +++ b/not/Effect.lua @@ -10,7 +10,7 @@ function Effect:new (name, x, y, world) end Effect.__super.new(self, x, y, world, nil) self.finished = false - self:setAnimationsList(require("config.animations.effects")) + self:setAnimations(require("config.animations.effects")) self:setAnimation(name) end diff --git a/not/Hero.lua b/not/Hero.lua index 3037837..2b5c529 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -49,7 +49,7 @@ function Hero:new (config, x, y, world) self.punchCooldown = 0 -- TODO: Pass loaded portrait from menu to Hero. self.portrait = love.graphics.newImage(config.portrait) - self:setAnimationsList(require("config.animations.hero")) + self:setAnimations(require("config.animations.hero")) -- Post-creation self:createEffect("respawn") end diff --git a/not/Platform.lua b/not/Platform.lua index a4b3a59..29c74cf 100644 --- a/not/Platform.lua +++ b/not/Platform.lua @@ -8,7 +8,7 @@ Platform = PhysicalBody:extends() -- Constructor of `Platform` function Platform:new (animations, shape, x, y, world, imagePath) Platform.__super.new(self, x, y, world, imagePath) - self:setAnimationsList(animations) + self:setAnimations(animations) -- Create table of shapes if single shape is passed. if type(shape[1]) == "number" then shape = {shape} diff --git a/not/Sprite.lua b/not/Sprite.lua index 191a7f7..a4bd6b8 100644 --- a/not/Sprite.lua +++ b/not/Sprite.lua @@ -48,7 +48,7 @@ function Sprite:getImage () end -- Sets new animations list. -function Sprite:setAnimationsList (t) +function Sprite:setAnimations (t) if t then self.animations = t self:setAnimation("default") diff --git a/not/Trap.lua b/not/Trap.lua index 0867a36..ec208bc 100644 --- a/not/Trap.lua +++ b/not/Trap.lua @@ -2,7 +2,7 @@ Trap = require "not.PhysicalBody":extends() function Trap:new (direction, x, y, world, imagePath) Trap.__super.new(self, x, y, world, imagePath) - self:setAnimationsList(require("config.animations.flames")) + self:setAnimations(require("config.animations.flames")) self:setBodyType("static") local mirror = 1 diff --git a/not/World.lua b/not/World.lua index cadb4fd..b01a94e 100644 --- a/not/World.lua +++ b/not/World.lua @@ -132,7 +132,7 @@ function World:buildMap () x = op.x y = op.y elseif op.animations then - entity:setAnimationsList(getAnimations(op.animations)) + entity:setAnimations(getAnimations(op.animations)) _,_,x,y = entity:getAnimation()[1]:getViewport() x, y = x / -2, y / -2 else -- cgit v1.1