summaryrefslogtreecommitdiffhomepage
path: root/not
diff options
context:
space:
mode:
Diffstat (limited to 'not')
-rw-r--r--not/Button.lua4
-rw-r--r--not/CloudGenerator.lua2
-rw-r--r--not/Effect.lua2
-rw-r--r--not/Header.lua2
-rw-r--r--not/Hero.lua212
-rw-r--r--not/Layer.lua2
-rw-r--r--not/MusicPlayer.lua2
-rw-r--r--not/PhysicalBody.lua12
-rw-r--r--not/Platform.lua2
-rw-r--r--not/Player.lua136
-rw-r--r--not/Ray.lua2
-rw-r--r--not/Selector.lua6
-rw-r--r--not/Settings.lua2
-rw-r--r--not/Sprite.lua8
-rw-r--r--not/Trap.lua2
-rw-r--r--not/World.lua6
16 files changed, 236 insertions, 166 deletions
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/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/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..676dc4a 100644
--- a/not/Hero.lua
+++ b/not/Hero.lua
@@ -4,8 +4,6 @@
Hero = require "not.PhysicalBody":extends()
-- Few are left...
-Hero.jumpTimer = 0.16
-Hero.jumpCounter = 2
Hero.sfx = require "config.sounds"
Hero.QUAD_FRAME = love.graphics.newQuad(0, 15, 32,32, 80,130)
@@ -19,6 +17,8 @@ Hero.PUNCH_LEFT = {-2,-6, -20,-6, -20,6, -2,6}
Hero.PUNCH_RIGHT = {2,-6, 20,-6, 20,6, 2,6}
Hero.PUNCH_UP = {-8,-4, -8,-20, 8,-20, 8,-4}
Hero.PUNCH_DOWN = {-8,4, -8,20, 8,20, 8,4}
+Hero.JUMP_TIMER = 0.16
+Hero.JUMP_COUNT = 2
-- TODO: Portrait managment in Hero and config passed from Menu should be reviewed!
-- TODO: Clean-up, see `menus/select`.
@@ -43,13 +43,13 @@ function Hero:new (config, x, y, world)
self.salto = false
self.smoke = false
self.isAlive = true
- self.isWalking = false
- self.isJumping = false
self.spawntimer = 2
+ self.jumpTimer = Hero.JUMP_TIMER
+ self.jumpCounter = Hero.JUMP_COUNT
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
@@ -70,13 +70,18 @@ function Hero:newFixture ()
fixture:setGroupIndex(self.group)
end
--- Update callback of `Hero`
+--- Called each game iteration.
+-- @param dt time since last iteration
+-- TODO: Cut this method into smaller parts.
function Hero:update (dt)
Hero.__super.update(self, dt)
+
if self.body:isDestroyed() then
return
end
+
self:dampVelocity(dt)
+
-- Salto
if self.salto and (self.current == self.animations.walk or self.current == self.animations.default) then
self.angle = (self.angle + 17 * dt * self.facing) % 360
@@ -84,7 +89,7 @@ function Hero:update (dt)
self.angle = 0
end
- -- Could you please die?
+ -- Death
-- TODO: World/Map function for testing if Point is inside playable area.
local m = self.world.map
local x, y = self:getPosition()
@@ -95,7 +100,7 @@ function Hero:update (dt)
self:die()
end
- -- Respawn timer.
+ -- Respawn
if self.spawntimer > 0 then
self.spawntimer = self.spawntimer - dt
end
@@ -103,18 +108,17 @@ function Hero:update (dt)
self:respawn()
end
- -- Trail spawner
+ -- Trail
-- TODO: lower the frequency of spawning - currently it is each frame.
if self.smoke and self.inAir then
local dx, dy = love.math.random(-5, 5), love.math.random(-5, 5)
self:createEffect("trail", dx, dy)
end
- -- # PUNCH
- -- Cooldown
+ -- Punch 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
@@ -124,7 +128,27 @@ function Hero:update (dt)
end
end
- -- Stop vertical
+ -- Walking
+ -- TODO: Walking is still not satisfactiory. Think of way to improve it.
+ if self:isWalking() then
+ if not self._already_walking then
+ self._already_walking = true
+ self:onWalkingStarted()
+ end
+ else
+ if self._already_walking then
+ self._already_walking = false
+ self:onWalkingStopped()
+ end
+ end
+ if self:isWalkingLeft() then
+ self:walk(-1)
+ end
+ if self:isWalkingRight() then
+ self:walk(1)
+ end
+
+ -- Set predefined velocity when attack animations are playing
local currentAnimation = self:getAnimation()
if self.frame < currentAnimation.frames then
if currentAnimation == self.animations.attack_up or currentAnimation == self.animations.attack_down then
@@ -134,11 +158,43 @@ function Hero:update (dt)
self:setLinearVelocity(38*self.facing, 0)
end
end
+
+ -- Jumping
+ if self:isJumping() then
+ if self.jumpTimer > 0 then
+ if not self._jumping then
+ self._jumping = true
+ self:onJumpStarted()
+ end
+ if self.jumpCounter == 0 or self.jumpCounter == 1 then
+ local x = self:getLinearVelocity()
+ self:setLinearVelocity(x,-160)
+ self.jumpTimer = self.jumpTimer - dt
+ end
+ end
+ else
+ if self._jumping then
+ self._jumping = false
+ self:onJumpStopped()
+ end
+ end
+end
+
+function Hero:walk (face)
+ local x, y = self:getLinearVelocity()
+ self.facing = face
+ self:applyForce(250 * face, 0)
+ if x > self.MAX_VELOCITY then
+ self:applyForce(-250, 0)
+ end
+ if x < -self.MAX_VELOCITY then
+ self:applyForce(250, 0)
+ end
end
--- Damps linear velocity every frame by applying minor force to body.
function Hero:dampVelocity (dt)
- if not self.isWalking then
+ if not self:isWalking() then
local face
local x, y = self:getLinearVelocity()
if x < -12 then
@@ -155,27 +211,71 @@ function Hero:dampVelocity (dt)
end
end
--- TODO: comment them and place them somewhere properly
-function Hero:getAngle ()
- return self.angle
+--- Called each time Hero starts walking.
+-- Is not called when direction of walking is changed.
+function Hero:onWalkingStarted ()
+ if (self.current ~= self.animations.attack) and
+ (self.current ~= self.animations.attack_up) and
+ (self.current ~= self.animations.attack_down) then
+ self:setAnimation("walk")
+ end
end
-function Hero:getHorizontalMirror ()
- return self.facing
+
+--- Called when Hero stops walking.
+-- Is not called when direction of walking is changed.
+function Hero:onWalkingStopped ()
+ if not (self:isControlDown("left") or self:isControlDown("right")) then
+ if self.current == self.animations.walk then
+ self:setAnimation("default")
+ end
+ end
end
-function Hero:getOffset ()
- return 12,15
+
+function Hero:onJumpStarted ()
+ self.smoke = false
+
+ if self.jumpCounter == 1 then
+ self.salto = true
+ end
+
+ self.jumpCounter = self.jumpCounter - 1
+
+ if self.jumpCounter > 0 then
+ if not self.inAir then
+ self:createEffect("jump")
+ else
+ self:createEffect("doublejump")
+ end
+
+ if (self.current == self.animations.attack) or
+ (self.current == self.animations.attack_up) or
+ (self.current == self.animations.attack_down) then
+ self:setAnimation("default")
+ end
+ end
+end
+
+function Hero:onJumpStopped ()
+ self.jumpTimer = Hero.JUMP_TIMER
end
function Hero:draw (debug)
if not self.isAlive then return end
Hero.__super.draw(self, debug)
+ if debug then
+ local x, y = self:getPosition()
+ love.graphics.setColor(255, 50, 50)
+ love.graphics.setFont(Font)
+ local msg = string.format("%d %s %s", self.jumpCounter, tostring(self.jumpTimer > 0), tostring(self:isJumping()))
+ love.graphics.print(msg, x + 10, y)
+ end
end
-- TODO: Hero@drawTag's printf is not readable.
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 +284,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
@@ -199,7 +299,7 @@ end
function Hero:goToNextFrame ()
if self.current.repeated or not (self.frame == self.current.frames) then
self.frame = (self.frame % self.current.frames) + 1
- elseif self.isWalking then
+ elseif self:isWalking() then
self:setAnimation("walk")
elseif self.current == self.animations.damage then
self:setAnimation("default")
@@ -221,23 +321,75 @@ end
-- Called by World when Hero starts contact with Platform (lands).
function Hero:land ()
self.inAir = false
- self.jumpCounter = 2
+ self.jumpCounter = Hero.JUMP_COUNT
self.salto = false
self.smoke = false
self:createEffect("land")
end
+function Hero:getAngle ()
+ return self.angle
+end
+
+function Hero:getHorizontalMirror ()
+ return self.facing
+end
+
+function Hero:getOffset ()
+ return 12,15
+end
+
+function Hero:isJumping ()
+ return false
+end
+
+function Hero:isWalking ()
+ return self:isWalkingLeft() or self:isWalkingRight()
+end
+
+function Hero:isWalkingLeft ()
+ return false
+end
+
+function Hero:isWalkingRight ()
+ return false
+end
+
-- Creates temporary fixture for hero's body that acts as sensor.
-- direction: ("left", "right", "up", "down")
-- Sensor fixture is deleted after time set in UserData[1]; deleted by `not.Hero.update`.
+-- TODO: While it's good that punch animation changes are here, it is still bad. There is too much similar code in this method.
function Hero:punch (direction)
self.punchCooldown = Hero.PUNCH_COOLDOWN
- -- Choose shape based on punch direction.
+ self.salto = false
+ self.smoke = false
+
local shape
- if direction == "left" then shape = Hero.PUNCH_LEFT end
- if direction == "right" then shape = Hero.PUNCH_RIGHT end
- if direction == "up" then shape = Hero.PUNCH_UP end
- if direction == "down" then shape = Hero.PUNCH_DOWN end
+ if direction == "left" then
+ shape = Hero.PUNCH_LEFT
+ if self.current ~= self.animations.damage then
+ self:setAnimation("attack")
+ end
+ end
+ if direction == "right" then
+ shape = Hero.PUNCH_RIGHT
+ if self.current ~= self.animations.damage then
+ self:setAnimation("attack")
+ end
+ end
+ if direction == "up" then
+ shape = Hero.PUNCH_UP
+ if self.current ~= self.animations.damage then
+ self:setAnimation("attack_up")
+ end
+ end
+ if direction == "down" then
+ shape = Hero.PUNCH_DOWN
+ if self.current ~= self.animations.damage then
+ self:setAnimation("attack_down")
+ end
+ end
+
-- Create and set sensor fixture.
local fixture = self:addFixture(shape, 0)
fixture:setSensor(true)
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/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
diff --git a/not/PhysicalBody.lua b/not/PhysicalBody.lua
index 5081836..0fb969f 100644
--- a/not/PhysicalBody.lua
+++ b/not/PhysicalBody.lua
@@ -65,23 +65,23 @@ 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
- 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/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/Player.lua b/not/Player.lua
index b0dac75..ac5d6aa 100644
--- a/not/Player.lua
+++ b/not/Player.lua
@@ -1,122 +1,54 @@
-require "not.Hero"
-
--- `Player`
--- Special `not.Hero` controllable by a player.
--- TODO: move functions and properties related to controls from `not.Hero`.
-Player = Hero:extends()
+-- Right now this is more or less wrapper for Hero and various methods related to players' input.
+-- TODO: Few more things should be exchanged between Player and Hero.
+-- TODO: In the end this class could be implemented in form of more verbose and functional Controller class. Think about it.
+Player = require "not.Hero":extends()
Player.controllerSet =--[[Controller.sets.*]]nil
--- Constructor of `Player`.
-function Player:new (name, x, y, world)
- Player.__super.new(self, name, x, y, world)
-end
-
--- Controller set manipulation.
+--- Assigns controller set to Player.
+-- @param set one of `Controller.sets`
function Player:assignControllerSet (set)
self.controllerSet = set
end
+
function Player:getControllerSet ()
return self.controllerSet
end
--- Check if control of assigned controller is pressed.
+--- Wrapper for checking if passed control is currently pressed.
function Player:isControlDown (control)
return Controller.isDown(self:getControllerSet(), control)
end
--- Update of `Player`.
-function Player:update (dt)
- Player.__super.update(self, dt) -- TODO: It would be probably a good idea to add return to update functions to terminate if something goes badly in parent's update.
- if self.body:isDestroyed() then return end
- local x, y = self:getLinearVelocity()
- -- Jumping.
- if self.isJumping and self.jumpTimer > 0 then
- self:setLinearVelocity(x,-160)
- self.jumpTimer = self.jumpTimer - dt
- end
+--- Overridden from Hero, used by Hero:update.
+function Player:isJumping ()
+ return self:isControlDown("jump")
+end
- -- Walking.
- if self:isControlDown("left") then
- self.facing = -1
- self:applyForce(-250, 0)
- -- Controlled speed limit
- if x < -self.MAX_VELOCITY then
- self:applyForce(250, 0)
- end
- end
- if self:isControlDown("right") then
- self.facing = 1
- self:applyForce(250, 0)
- -- Controlled speed limit
- if x > self.MAX_VELOCITY then
- self:applyForce(-250, 0)
- end
- end
+--- Overridden from Hero, used by Hero:update.
+function Player:isWalkingLeft ()
+ return self:isControlDown("left")
+end
+
+--- Overridden from Hero, used by Hero:update.
+function Player:isWalkingRight ()
+ return self:isControlDown("right")
end
--- Controller callbacks.
+--- Called when control is pressed.
+-- @param set ControllerSet that owns pressed control
+-- @param action action assigned to control
+-- @param key parent key of control
function Player:controlpressed (set, action, key)
if set ~= self:getControllerSet() then return end
- self.smoke = false -- TODO: temporary
- -- Jumping
- if action == "jump" then
- if self.jumpCounter > 0 then
- -- General jump logics
- self.isJumping = true
- --self:playSound(6)
- -- Spawn proper effect
- if not self.inAir then
- self:createEffect("jump")
- else
- self:createEffect("doublejump")
- end
- -- Start salto if last jump
- if self.jumpCounter == 1 then
- self.salto = true
- end
- -- Animation clear
- if (self.current == self.animations.attack) or
- (self.current == self.animations.attack_up) or
- (self.current == self.animations.attack_down) then
- self:setAnimation("default")
- end
- -- Remove jump
- self.jumpCounter = self.jumpCounter - 1
- end
- end
-
- -- Walking
- if (action == "left" or action == "right") then
- self.isWalking = true
- if (self.current ~= self.animations.attack) and
- (self.current ~= self.animations.attack_up) and
- (self.current ~= self.animations.attack_down) then
- self:setAnimation("walk")
- end
- end
-
- -- Punching
if action == "attack" and self.punchCooldown <= 0 then
local f = self.facing
- self.salto = false
if self:isControlDown("up") then
- -- Punch up
- if self.current ~= self.animations.damage then
- self:setAnimation("attack_up")
- end
self:punch("up")
elseif self:isControlDown("down") then
- -- Punch down
- if self.current ~= self.animations.damage then
- self:setAnimation("attack_down")
- end
self:punch("down")
else
- -- Punch horizontal
- if self.current ~= self.animations.damage then
- self:setAnimation("attack")
- end
if f == 1 then
self:punch("right")
else
@@ -125,22 +57,8 @@ function Player:controlpressed (set, action, key)
end
end
end
-function Player:controlreleased (set, action, key)
- if set ~= self:getControllerSet() then return end
- -- Jumping
- if action == "jump" then
- self.isJumping = false
- self.jumpTimer = Hero.jumpTimer -- take initial from metatable
- end
- -- Walking
- if (action == "left" or action == "right") then
- if not (self:isControlDown("left") or self:isControlDown("right")) then
- self.isWalking = false
- if self.current == self.animations.walk then
- self:setAnimation("default")
- end
- end
- end
-end
+
+--- Called when control is released.
+function Player:controlreleased (set, action, key) end
return Player
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/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")
diff --git a/not/Sprite.lua b/not/Sprite.lua
index ec23eac..a4bd6b8 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
@@ -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")
@@ -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/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 a5854d4..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
@@ -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()