From 666aa13565c1f577f493a0eda5f9799cefea110a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 16 Jun 2019 18:32:31 +0200 Subject: [PATCH] chore(levels): rename Actor.collType to Actor.type --- .../scenes/levels/entities/bullet.lua | 4 ++-- .../scenes/levels/entities/collision.lua | 4 ++-- .../scenes/levels/entities/debris.lua | 2 +- .../scenes/levels/entities/loot/parent.lua | 2 +- .../scenes/levels/entities/parent.lua | 8 ++++---- .../scenes/levels/entities/player.lua | 10 +++++----- .../scenes/levels/entities/weapon.lua | 12 ++++++------ 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/imperium-porcorum.love/scenes/levels/entities/bullet.lua b/imperium-porcorum.love/scenes/levels/entities/bullet.lua index f65d85e..6a24fc3 100644 --- a/imperium-porcorum.love/scenes/levels/entities/bullet.lua +++ b/imperium-porcorum.love/scenes/levels/entities/bullet.lua @@ -10,7 +10,7 @@ end function Bullet:setFilter() self.filter = function(item, other) - if (other.collType=="wall") then + if (other.type=="wall") then return 'touch' else return nil @@ -26,7 +26,7 @@ function Bullet:update(dt) for j=1,cols_len do local other = cols[j].other - if other.collType=="wall" and (self.life == 1) then + if other.type=="wall" and (self.life == 1) then self:destroy() end end diff --git a/imperium-porcorum.love/scenes/levels/entities/collision.lua b/imperium-porcorum.love/scenes/levels/entities/collision.lua index d7b0e5c..7fc585f 100644 --- a/imperium-porcorum.love/scenes/levels/entities/collision.lua +++ b/imperium-porcorum.love/scenes/levels/entities/collision.lua @@ -2,8 +2,8 @@ local Entity = require "scenes.levels.entities.parent" local Collision = Entity:extend() -function Collision:new(world, x, y, w, h, collType) - Collision.super.new(self, world, collType, x, y, w, h) +function Collision:new(world, x, y, w, h, type) + Collision.super.new(self, world, type, x, y, w, h) self:setDebugColor(0,0,0) end diff --git a/imperium-porcorum.love/scenes/levels/entities/debris.lua b/imperium-porcorum.love/scenes/levels/entities/debris.lua index 29f10c9..d5be766 100644 --- a/imperium-porcorum.love/scenes/levels/entities/debris.lua +++ b/imperium-porcorum.love/scenes/levels/entities/debris.lua @@ -16,7 +16,7 @@ end function Debris:setFilter() self.filter = function(item, other) - if ((other.collType=="wall")) then + if ((other.type=="wall")) then return 'bounce' else return nil diff --git a/imperium-porcorum.love/scenes/levels/entities/loot/parent.lua b/imperium-porcorum.love/scenes/levels/entities/loot/parent.lua index a69f38c..c7b6b55 100644 --- a/imperium-porcorum.love/scenes/levels/entities/loot/parent.lua +++ b/imperium-porcorum.love/scenes/levels/entities/loot/parent.lua @@ -4,7 +4,7 @@ local Loot = Entity:extend() function Loot:new(world, x, y, name) Loot.super.new(self, world, "loot", x, y, 16, 16) - self.collType = "loot" + self.type = "loot" self.sprite = name end diff --git a/imperium-porcorum.love/scenes/levels/entities/parent.lua b/imperium-porcorum.love/scenes/levels/entities/parent.lua index 8f69650..b28e9cc 100644 --- a/imperium-porcorum.love/scenes/levels/entities/parent.lua +++ b/imperium-porcorum.love/scenes/levels/entities/parent.lua @@ -1,18 +1,18 @@ local Entity = Object:extend() -- On créer la classe des entitées, c'est la classe de base -function Entity:new(world, collType, x, y, w, h) -- On enregistre une nouvelle entité, avec par défaut sa hitbox. - self:initPhysics(world, collType, x, y, w, h) +function Entity:new(world, type, x, y, w, h) -- On enregistre une nouvelle entité, avec par défaut sa hitbox. + self:initPhysics(world, type, x, y, w, h) self.destroyed = false self.registered = false self:setDebugColor(0,0,0) end -function Entity:initPhysics(world, collType, x, y, w, h) +function Entity:initPhysics(world, type, x, y, w, h) self.scene = world.scene self.world = world self.camera = self.scene.camera self.obj = self.world.obj - self.collType = collType + self.type = type self.gacc = 550 self.xsp = 0 diff --git a/imperium-porcorum.love/scenes/levels/entities/player.lua b/imperium-porcorum.love/scenes/levels/entities/player.lua index 1acd948..9b1525f 100644 --- a/imperium-porcorum.love/scenes/levels/entities/player.lua +++ b/imperium-porcorum.love/scenes/levels/entities/player.lua @@ -91,12 +91,12 @@ end function Player:setFilter() self.filter = function(item, other) - if (other.collType == "wall") then return 'slide' - elseif (other.collType == "block") then return 'slide' - elseif (other.collType == "platform") and + if (other.type == "wall") then return 'slide' + elseif (other.type == "block") then return 'slide' + elseif (other.type == "platform") and (self.ysp > 0) and ((self.y+24) <= other.y) then return 'slide' - elseif (other.collType == "loot") then return 'cross' + elseif (other.type == "loot") then return 'cross' else return nil end end @@ -106,7 +106,7 @@ function Player:resolveCollisions(cols, cols_len) local cols, cols_len = cols, cols_len for j=1,cols_len do local other = cols[j].other - if (other.collType == "loot") then + if (other.type == "loot") then other:takeLoot() end end diff --git a/imperium-porcorum.love/scenes/levels/entities/weapon.lua b/imperium-porcorum.love/scenes/levels/entities/weapon.lua index c8e2cb6..b4b8476 100644 --- a/imperium-porcorum.love/scenes/levels/entities/weapon.lua +++ b/imperium-porcorum.love/scenes/levels/entities/weapon.lua @@ -12,11 +12,11 @@ end function Weapon:setFilter() self.filter = function(item, other) - if (other.collType=="wall") then + if (other.type=="wall") then return 'touch' - elseif (other.collType=="block") then + elseif (other.type=="block") then return "touch" - elseif (other.collType=="ennemy") then + elseif (other.type=="ennemy") then return "touch" else return nil @@ -33,14 +33,14 @@ function Weapon:update(dt) for j=1,cols_len do local other = cols[j].other - if other.collType=="wall" and (self.life == 1) then + if other.type=="wall" and (self.life == 1) then self:destroy() end - if other.collType=="block" and (self.life == 1) then + if other.type=="block" and (self.life == 1) then self:destroy() other:breakBlock() end - if other.collType=="ennemy" and (self.life == 1) then + if other.type=="ennemy" and (self.life == 1) then self:destroy() other:getDamage(1) end