From dd9245c6b22f756bc439960afabf5793634c45f5 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 01:32:45 +0200 Subject: Split nauts.lua into several files now used by Hero and Menu --- config/menus/select.lua | 32 ++++++++++++++++++++++++------- config/nauts.lua | 46 --------------------------------------------- config/nauts/biker.lua | 8 ++++++++ config/nauts/bison.lua | 8 ++++++++ config/nauts/blblal.lua | 8 ++++++++ config/nauts/bobito.lua | 8 ++++++++ config/nauts/brainos.lua | 8 ++++++++ config/nauts/bug.lua | 8 ++++++++ config/nauts/calamari.lua | 8 ++++++++ config/nauts/capone.lua | 8 ++++++++ config/nauts/cowboy.lua | 8 ++++++++ config/nauts/cowman.lua | 8 ++++++++ config/nauts/disco.lua | 8 ++++++++ config/nauts/dundee.lua | 8 ++++++++ config/nauts/froggirl.lua | 8 ++++++++ config/nauts/froggo.lua | 8 ++++++++ config/nauts/gelato.lua | 8 ++++++++ config/nauts/girl.lua | 8 ++++++++ config/nauts/gramps.lua | 8 ++++++++ config/nauts/gummybear.lua | 8 ++++++++ config/nauts/honic.lua | 8 ++++++++ config/nauts/joystick.lua | 8 ++++++++ config/nauts/kong.lua | 8 ++++++++ config/nauts/lady.lua | 8 ++++++++ config/nauts/link.lua | 8 ++++++++ config/nauts/marine.lua | 8 ++++++++ config/nauts/megoman.lua | 8 ++++++++ config/nauts/missile.lua | 8 ++++++++ config/nauts/nemo.lua | 8 ++++++++ config/nauts/phonebooth.lua | 8 ++++++++ config/nauts/quack.lua | 8 ++++++++ config/nauts/rock.lua | 8 ++++++++ config/nauts/scissors.lua | 8 ++++++++ config/nauts/scooter.lua | 8 ++++++++ config/nauts/shutter.lua | 8 ++++++++ config/nauts/slugzor.lua | 8 ++++++++ config/nauts/swarm.lua | 8 ++++++++ config/nauts/veno.lua | 8 ++++++++ config/nauts/vrooom.lua | 8 ++++++++ config/nauts/weed.lua | 8 ++++++++ config/nauts/woman.lua | 8 ++++++++ config/nauts/yarr.lua | 8 ++++++++ not/Hero.lua | 12 ++++++------ 43 files changed, 351 insertions(+), 59 deletions(-) delete mode 100644 config/nauts.lua create mode 100644 config/nauts/biker.lua create mode 100644 config/nauts/bison.lua create mode 100644 config/nauts/blblal.lua create mode 100644 config/nauts/bobito.lua create mode 100644 config/nauts/brainos.lua create mode 100644 config/nauts/bug.lua create mode 100644 config/nauts/calamari.lua create mode 100644 config/nauts/capone.lua create mode 100644 config/nauts/cowboy.lua create mode 100644 config/nauts/cowman.lua create mode 100644 config/nauts/disco.lua create mode 100644 config/nauts/dundee.lua create mode 100644 config/nauts/froggirl.lua create mode 100644 config/nauts/froggo.lua create mode 100644 config/nauts/gelato.lua create mode 100644 config/nauts/girl.lua create mode 100644 config/nauts/gramps.lua create mode 100644 config/nauts/gummybear.lua create mode 100644 config/nauts/honic.lua create mode 100644 config/nauts/joystick.lua create mode 100644 config/nauts/kong.lua create mode 100644 config/nauts/lady.lua create mode 100644 config/nauts/link.lua create mode 100644 config/nauts/marine.lua create mode 100644 config/nauts/megoman.lua create mode 100644 config/nauts/missile.lua create mode 100644 config/nauts/nemo.lua create mode 100644 config/nauts/phonebooth.lua create mode 100644 config/nauts/quack.lua create mode 100644 config/nauts/rock.lua create mode 100644 config/nauts/scissors.lua create mode 100644 config/nauts/scooter.lua create mode 100644 config/nauts/shutter.lua create mode 100644 config/nauts/slugzor.lua create mode 100644 config/nauts/swarm.lua create mode 100644 config/nauts/veno.lua create mode 100644 config/nauts/vrooom.lua create mode 100644 config/nauts/weed.lua create mode 100644 config/nauts/woman.lua create mode 100644 config/nauts/yarr.lua diff --git a/config/menus/select.lua b/config/menus/select.lua index fee7c94..0d8bef9 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -14,25 +14,40 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: Temporary group for naut selectors. This isn't production code at any means! +-- TODO: Icons for nauts and maps are still waiting to get their assets split. local group, get do local atlas = love.graphics.newImage("assets/portraits.png") - local nauts = require("config.nauts") - local icons = {} - for i=0,#nauts-1 do - table.insert(icons, love.graphics.newQuad(i*28, 0, 28, 27, 1176, 27)) + local nauts, icons = {}, {} + local files = love.filesystem.getDirectoryItems("config/nauts") + for _,filename in pairs(files) do + local path = string.format("config/nauts/%s", filename) + if love.filesystem.isFile(path) and filename ~= "readme.md" then + local naut = love.filesystem.load(path)() + local i, name = naut.portrait, naut.name + if naut.available then + table.insert(icons, love.graphics.newQuad((i-1)*28, 0, 28, 27, 1176, 27)) + table.insert(nauts, naut) + end + end end + -- TODO: Find a better way to add empty and random entries to naut Selector. + table.insert(icons, 1, love.graphics.newQuad((1-1)*28, 0, 28, 27, 1176, 27)) + table.insert(nauts, 1, {name = "empty"}) + table.insert(icons, 2, love.graphics.newQuad((2-1)*28, 0, 28, 27, 1176, 27)) + table.insert(nauts, 2, {name = "random"}) + group = Group(menu) local function attack (self) if not self.lock then - if self.index == 1 then + local selected = self:getSelected() + if selected.name == "empty" then return end - if self.index == 2 then + if selected.name == "random" then self.index = self:rollRandom({1, 2}) end if self:isUnique() then @@ -46,6 +61,9 @@ do :set("icons_atlas", atlas) :set("icons_quads", icons) :set("attack", attack) + :set("getText", function (self) + return string.upper(self:getSelected().name) + end) end group:set("margin", 16) diff --git a/config/nauts.lua b/config/nauts.lua deleted file mode 100644 index aa351b9..0000000 --- a/config/nauts.lua +++ /dev/null @@ -1,46 +0,0 @@ --- List of characters with empty character included --- icons list is generated from this file -return { - "empty", -- empty - "random", --random - "froggo", -- froggy - "cowboy", -- lonestar - "honic", -- leon - "gelato", -- scoop - "veno", -- gnaw - "lady", -- raelynn - "girl", -- ayla - "megoman", -- clunk - "brainos", -- voltar - "woman", -- coco - "bison", -- skolldir - "bobito", -- yuri - "slugzor", -- derpl - "capone", -- vinnie - "nemo", -- spike - "bug", -- genji - "calamari", -- swiggins - "quack", -- rocco - "scissors", -- ksenia - "link", -- ix - "cowman", -- deadlift - "marine", -- ted - "scooter", -- penny - "phonebooth", -- sentry - "weed", -- skree - "gummybear", -- nibbs - "gramps", -- yoolip - "biker", -- chucho - "vrooom", -- lux - "shutter", -- max - "froggirl", -- dizzy - "dundee", -- smiles - "missile", -- commander rocket - "swarm", -- qi'tara - "disco", -- esc rocco - "joystick", -- 8-bit yoolip - "yarr", -- ted pirate - "blblal", -- blabl zork - "kong", -- ronimo - "rock", -- rock -} diff --git a/config/nauts/biker.lua b/config/nauts/biker.lua new file mode 100644 index 0000000..c139e87 --- /dev/null +++ b/config/nauts/biker.lua @@ -0,0 +1,8 @@ +--- chucho +return +{ + name = "biker", + image = "assets/nauts/biker.png", + portrait = 30, + available = true +} diff --git a/config/nauts/bison.lua b/config/nauts/bison.lua new file mode 100644 index 0000000..35c08ca --- /dev/null +++ b/config/nauts/bison.lua @@ -0,0 +1,8 @@ +--- skolldir +return +{ + name = "bison", + image = "assets/nauts/bison.png", + portrait = 13, + available = true +} diff --git a/config/nauts/blblal.lua b/config/nauts/blblal.lua new file mode 100644 index 0000000..4bc9884 --- /dev/null +++ b/config/nauts/blblal.lua @@ -0,0 +1,8 @@ +--- blabl zork +return +{ + name = "blblal", + image = "assets/nauts/blblal.png", + portrait = 40, + available = false +} diff --git a/config/nauts/bobito.lua b/config/nauts/bobito.lua new file mode 100644 index 0000000..f00fa7f --- /dev/null +++ b/config/nauts/bobito.lua @@ -0,0 +1,8 @@ +--- yuri +return +{ + name = "bobito", + image = "assets/nauts/bobito.png", + portrait = 14, + available = true +} diff --git a/config/nauts/brainos.lua b/config/nauts/brainos.lua new file mode 100644 index 0000000..908f57a --- /dev/null +++ b/config/nauts/brainos.lua @@ -0,0 +1,8 @@ +--- voltar +return +{ + name = "brainos", + image = "assets/nauts/brainos.png", + portrait = 11, + available = true +} diff --git a/config/nauts/bug.lua b/config/nauts/bug.lua new file mode 100644 index 0000000..3989ade --- /dev/null +++ b/config/nauts/bug.lua @@ -0,0 +1,8 @@ +--- genji +return +{ + name = "bug", + image = "assets/nauts/bug.png", + portrait = 18, + available = true +} diff --git a/config/nauts/calamari.lua b/config/nauts/calamari.lua new file mode 100644 index 0000000..3168023 --- /dev/null +++ b/config/nauts/calamari.lua @@ -0,0 +1,8 @@ +--- swiggins +return +{ + name = "calamari", + image = "assets/nauts/calamari.png", + portrait = 19, + available = true +} diff --git a/config/nauts/capone.lua b/config/nauts/capone.lua new file mode 100644 index 0000000..edd5f35 --- /dev/null +++ b/config/nauts/capone.lua @@ -0,0 +1,8 @@ +--- vinnie +return +{ + name = "capone", + image = "assets/nauts/capone.png", + portrait = 16, + available = true +} diff --git a/config/nauts/cowboy.lua b/config/nauts/cowboy.lua new file mode 100644 index 0000000..d7ac120 --- /dev/null +++ b/config/nauts/cowboy.lua @@ -0,0 +1,8 @@ +--- lonestar +return +{ + name = "cowboy", + image = "assets/nauts/cowboy.png", + portrait = 4, + available = true +} diff --git a/config/nauts/cowman.lua b/config/nauts/cowman.lua new file mode 100644 index 0000000..5bbde57 --- /dev/null +++ b/config/nauts/cowman.lua @@ -0,0 +1,8 @@ +--- deadlift +return +{ + name = "cowman", + image = "assets/nauts/cowman.png", + portrait = 23, + available = true +} diff --git a/config/nauts/disco.lua b/config/nauts/disco.lua new file mode 100644 index 0000000..e579257 --- /dev/null +++ b/config/nauts/disco.lua @@ -0,0 +1,8 @@ +--- esc rocco +return +{ + name = "disco", + image = "assets/nauts/disco.png", + portrait = 37, + available = false +} diff --git a/config/nauts/dundee.lua b/config/nauts/dundee.lua new file mode 100644 index 0000000..3299db8 --- /dev/null +++ b/config/nauts/dundee.lua @@ -0,0 +1,8 @@ +--- smiles +return +{ + name = "dundee", + image = "assets/nauts/dundee.png", + portrait = 34, + available = true +} diff --git a/config/nauts/froggirl.lua b/config/nauts/froggirl.lua new file mode 100644 index 0000000..b587043 --- /dev/null +++ b/config/nauts/froggirl.lua @@ -0,0 +1,8 @@ +--- dizzy +return +{ + name = "froggirl", + image = "assets/nauts/froggirl.png", + portrait = 33, + available = true +} diff --git a/config/nauts/froggo.lua b/config/nauts/froggo.lua new file mode 100644 index 0000000..e1c7d85 --- /dev/null +++ b/config/nauts/froggo.lua @@ -0,0 +1,8 @@ +--- froggy +return +{ + name = "froggo", + image = "assets/nauts/froggo.png", + portrait = 3, + available = true +} diff --git a/config/nauts/gelato.lua b/config/nauts/gelato.lua new file mode 100644 index 0000000..f3f4ed5 --- /dev/null +++ b/config/nauts/gelato.lua @@ -0,0 +1,8 @@ +--- scoop +return +{ + name = "gelato", + image = "assets/nauts/gelato.png", + portrait = 6, + available = true +} diff --git a/config/nauts/girl.lua b/config/nauts/girl.lua new file mode 100644 index 0000000..b1d9d8a --- /dev/null +++ b/config/nauts/girl.lua @@ -0,0 +1,8 @@ +--- ayla +return +{ + name = "girl", + image = "assets/nauts/girl.png", + portrait = 9, + available = true +} diff --git a/config/nauts/gramps.lua b/config/nauts/gramps.lua new file mode 100644 index 0000000..51aa672 --- /dev/null +++ b/config/nauts/gramps.lua @@ -0,0 +1,8 @@ +--- yoolip +return +{ + name = "gramps", + image = "assets/nauts/gramps.png", + portrait = 29, + available = true +} diff --git a/config/nauts/gummybear.lua b/config/nauts/gummybear.lua new file mode 100644 index 0000000..a39287f --- /dev/null +++ b/config/nauts/gummybear.lua @@ -0,0 +1,8 @@ +--- nibbs +return +{ + name = "gummybear", + image = "assets/nauts/gummybear.png", + portrait = 28, + available = true +} diff --git a/config/nauts/honic.lua b/config/nauts/honic.lua new file mode 100644 index 0000000..2ff6584 --- /dev/null +++ b/config/nauts/honic.lua @@ -0,0 +1,8 @@ +--- leon +return +{ + name = "honic", + image = "assets/nauts/honic.png", + portrait = 5, + available = true +} diff --git a/config/nauts/joystick.lua b/config/nauts/joystick.lua new file mode 100644 index 0000000..44e8adb --- /dev/null +++ b/config/nauts/joystick.lua @@ -0,0 +1,8 @@ +--- retro yoolip +return +{ + name = "joystick", + image = "assets/nauts/joystick.png", + portrait = 38, + available = false +} diff --git a/config/nauts/kong.lua b/config/nauts/kong.lua new file mode 100644 index 0000000..731f7f1 --- /dev/null +++ b/config/nauts/kong.lua @@ -0,0 +1,8 @@ +--- ronimo +return +{ + name = "kong", + image = "assets/nauts/kong.png", + portrait = 41, + available = false +} diff --git a/config/nauts/lady.lua b/config/nauts/lady.lua new file mode 100644 index 0000000..77ef7a3 --- /dev/null +++ b/config/nauts/lady.lua @@ -0,0 +1,8 @@ +--- raelynn +return +{ + name = "lady", + image = "assets/nauts/lady.png", + portrait = 8, + available = true +} diff --git a/config/nauts/link.lua b/config/nauts/link.lua new file mode 100644 index 0000000..1f6b430 --- /dev/null +++ b/config/nauts/link.lua @@ -0,0 +1,8 @@ +--- ix +return +{ + name = "link", + image = "assets/nauts/link.png", + portrait = 22, + available = true +} diff --git a/config/nauts/marine.lua b/config/nauts/marine.lua new file mode 100644 index 0000000..a0c0647 --- /dev/null +++ b/config/nauts/marine.lua @@ -0,0 +1,8 @@ +--- ted +return +{ + name = "marine", + image = "assets/nauts/marine.png", + portrait = 24, + available = true +} diff --git a/config/nauts/megoman.lua b/config/nauts/megoman.lua new file mode 100644 index 0000000..119e0fc --- /dev/null +++ b/config/nauts/megoman.lua @@ -0,0 +1,8 @@ +--- clunk +return +{ + name = "megoman", + image = "assets/nauts/megoman.png", + portrait = 10, + available = true +} diff --git a/config/nauts/missile.lua b/config/nauts/missile.lua new file mode 100644 index 0000000..5fb4d49 --- /dev/null +++ b/config/nauts/missile.lua @@ -0,0 +1,8 @@ +--- commander rocket +return +{ + name = "missile", + image = "assets/nauts/missile.png", + portrait = 35, + available = true +} diff --git a/config/nauts/nemo.lua b/config/nauts/nemo.lua new file mode 100644 index 0000000..fabcae6 --- /dev/null +++ b/config/nauts/nemo.lua @@ -0,0 +1,8 @@ +--- spike +return +{ + name = "nemo", + image = "assets/nauts/nemo.png", + portrait = 17, + available = true +} diff --git a/config/nauts/phonebooth.lua b/config/nauts/phonebooth.lua new file mode 100644 index 0000000..3c1ad10 --- /dev/null +++ b/config/nauts/phonebooth.lua @@ -0,0 +1,8 @@ +--- sentry +return +{ + name = "phonebooth", + image = "assets/nauts/phonebooth.png", + portrait = 26, + available = true +} diff --git a/config/nauts/quack.lua b/config/nauts/quack.lua new file mode 100644 index 0000000..e4a0d7a --- /dev/null +++ b/config/nauts/quack.lua @@ -0,0 +1,8 @@ +--- rocco +return +{ + name = "quack", + image = "assets/nauts/quack.png", + portrait = 20, + available = true +} diff --git a/config/nauts/rock.lua b/config/nauts/rock.lua new file mode 100644 index 0000000..758e62a --- /dev/null +++ b/config/nauts/rock.lua @@ -0,0 +1,8 @@ +--- rock +return +{ + name = "rock", + image = "assets/nauts/rock.png", + portrait = 42, + available = false +} diff --git a/config/nauts/scissors.lua b/config/nauts/scissors.lua new file mode 100644 index 0000000..7526e47 --- /dev/null +++ b/config/nauts/scissors.lua @@ -0,0 +1,8 @@ +--- ksenia +return +{ + name = "scissors", + image = "assets/nauts/scissors.png", + portrait = 21, + available = true +} diff --git a/config/nauts/scooter.lua b/config/nauts/scooter.lua new file mode 100644 index 0000000..7b1a2aa --- /dev/null +++ b/config/nauts/scooter.lua @@ -0,0 +1,8 @@ +--- penny +return +{ + name = "scooter", + image = "assets/nauts/scooter.png", + portrait = 25, + available = true +} diff --git a/config/nauts/shutter.lua b/config/nauts/shutter.lua new file mode 100644 index 0000000..d0e7787 --- /dev/null +++ b/config/nauts/shutter.lua @@ -0,0 +1,8 @@ +--- max +return +{ + name = "shutter", + image = "assets/nauts/shutter.png", + portrait = 32, + available = true +} diff --git a/config/nauts/slugzor.lua b/config/nauts/slugzor.lua new file mode 100644 index 0000000..f51c5d3 --- /dev/null +++ b/config/nauts/slugzor.lua @@ -0,0 +1,8 @@ +--- derpl +return +{ + name = "slugzor", + image = "assets/nauts/slugzor.png", + portrait = 15, + available = true +} diff --git a/config/nauts/swarm.lua b/config/nauts/swarm.lua new file mode 100644 index 0000000..575478b --- /dev/null +++ b/config/nauts/swarm.lua @@ -0,0 +1,8 @@ +--- qitara +return +{ + name = "swarm", + image = "assets/nauts/swarm.png", + portrait = 36, + available = false +} diff --git a/config/nauts/veno.lua b/config/nauts/veno.lua new file mode 100644 index 0000000..8973173 --- /dev/null +++ b/config/nauts/veno.lua @@ -0,0 +1,8 @@ +--- gnaw +return +{ + name = "veno", + image = "assets/nauts/veno.png", + portrait = 7, + available = true +} diff --git a/config/nauts/vrooom.lua b/config/nauts/vrooom.lua new file mode 100644 index 0000000..fa02a68 --- /dev/null +++ b/config/nauts/vrooom.lua @@ -0,0 +1,8 @@ +--- lux +return +{ + name = "vrooom", + image = "assets/nauts/vrooom.png", + portrait = 31, + available = true +} diff --git a/config/nauts/weed.lua b/config/nauts/weed.lua new file mode 100644 index 0000000..4c2216e --- /dev/null +++ b/config/nauts/weed.lua @@ -0,0 +1,8 @@ +--- skree +return +{ + name = "weed", + image = "assets/nauts/weed.png", + portrait = 27, + available = true +} diff --git a/config/nauts/woman.lua b/config/nauts/woman.lua new file mode 100644 index 0000000..88ac22e --- /dev/null +++ b/config/nauts/woman.lua @@ -0,0 +1,8 @@ +--- coco +return +{ + name = "woman", + image = "assets/nauts/woman.png", + portrait = 12, + available = true +} diff --git a/config/nauts/yarr.lua b/config/nauts/yarr.lua new file mode 100644 index 0000000..cd8e724 --- /dev/null +++ b/config/nauts/yarr.lua @@ -0,0 +1,8 @@ +--- ted pirate +return +{ + name = "yarr", + image = "assets/nauts/yarr.png", + portrait = 39, + available = false +} diff --git a/not/Hero.lua b/not/Hero.lua index 66bc511..a735107 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -8,7 +8,6 @@ Hero.jumpTimer = 0.16 Hero.jumpCounter = 2 Hero.sfx = require "config.sounds" -Hero.QUAD_PORTRAITS = getNautsIconsList() Hero.QUAD_FRAME = love.graphics.newQuad(0, 15, 32,32, 80,130) Hero.IMAGE_PORTRAITS = nil Hero.IMAGE_FRAME = nil @@ -21,9 +20,9 @@ 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} --- Constructor of `Hero`. -function Hero:new (name, x, y, world) - local imagePath = string.format("assets/nauts/%s.png", name) +-- TODO: Portrait managment in Hero and config passed from Menu should be reviewed! +function Hero:new (config, x, y, world) + local imagePath = config.image Hero.load() Hero.__super.new(self, x, y, world, imagePath) -- Physics @@ -33,7 +32,7 @@ function Hero:new (name, x, y, world) self:newFixture() -- General self.world = world - self.name = name + self.name = config.name self.angle = 0 self.facing = 1 -- Status @@ -47,6 +46,7 @@ function Hero:new (name, x, y, world) self.isJumping = false self.spawntimer = 2 self.punchCooldown = 0 + self.portrait = love.graphics.newQuad((config.portrait-1)*28, 0, 28, 27, 1176, 27) self:setAnimationsList(require("config.animations.hero")) -- Post-creation self:createEffect("respawn") @@ -185,7 +185,7 @@ function Hero:drawHUD (x,y,scale,elevation) if self.isAlive then love.graphics.setColor(255,255,255,255) love.graphics.draw(self.IMAGE_FRAME, self.QUAD_FRAME, (x)*scale, (y)*scale, 0, scale, scale) - love.graphics.draw(self.IMAGE_PORTRAITS, self.QUAD_PORTRAITS[self.name], (x+2)*scale, (y+3)*scale, 0, scale, scale) + love.graphics.draw(self.IMAGE_PORTRAITS, self.portrait, (x+2)*scale, (y+3)*scale, 0, scale, scale) local dy = 30 * elevation love.graphics.setFont(Font) love.graphics.print((self.combo).."%",(x+2)*scale,(y-3+dy)*scale,0,scale,scale) -- cgit v1.1 From 1a4db161e7be614e002c4f8edccbf3acf1edc6aa Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 15:00:31 +0200 Subject: Changed portrait quad property name in Hero --- not/Hero.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/not/Hero.lua b/not/Hero.lua index a735107..2549b18 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -46,7 +46,7 @@ function Hero:new (config, x, y, world) self.isJumping = false self.spawntimer = 2 self.punchCooldown = 0 - self.portrait = love.graphics.newQuad((config.portrait-1)*28, 0, 28, 27, 1176, 27) + self.portraitQuad = love.graphics.newQuad((config.portrait-1)*28, 0, 28, 27, 1176, 27) self:setAnimationsList(require("config.animations.hero")) -- Post-creation self:createEffect("respawn") @@ -185,7 +185,7 @@ function Hero:drawHUD (x,y,scale,elevation) if self.isAlive then love.graphics.setColor(255,255,255,255) love.graphics.draw(self.IMAGE_FRAME, self.QUAD_FRAME, (x)*scale, (y)*scale, 0, scale, scale) - love.graphics.draw(self.IMAGE_PORTRAITS, self.portrait, (x+2)*scale, (y+3)*scale, 0, scale, scale) + love.graphics.draw(self.IMAGE_PORTRAITS, self.portraitQuad, (x+2)*scale, (y+3)*scale, 0, scale, scale) local dy = 30 * elevation love.graphics.setFont(Font) love.graphics.print((self.combo).."%",(x+2)*scale,(y-3+dy)*scale,0,scale,scale) -- cgit v1.1 From 118c64c62bb19239a28da08f928c2f8e74655f08 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:01:09 +0200 Subject: Split map icons, menu now uses them --- assets/maps.png | Bin 10688 -> 0 bytes assets/maps/205.png | Bin 0 -> 742 bytes assets/maps/404.png | Bin 0 -> 706 bytes assets/maps/aiguillon.png | Bin 0 -> 1063 bytes assets/maps/alpha.png | Bin 0 -> 601 bytes assets/maps/default.png | Bin 0 -> 742 bytes assets/maps/ribbit.png | Bin 0 -> 1045 bytes assets/maps/rill.png | Bin 0 -> 1026 bytes assets/maps/sorona.png | Bin 0 -> 1153 bytes assets/maps/starstorm.png | Bin 0 -> 515 bytes config/maps/205.lua | 2 +- config/maps/404.lua | 4 ++-- config/maps/aiguillon.lua | 2 +- config/maps/alpha.lua | 2 +- config/maps/default.lua | 2 +- config/maps/ribbit.lua | 2 +- config/maps/rill.lua | 2 +- config/maps/sorona.lua | 2 +- config/maps/starstorm.lua | 2 +- config/menus/host.lua | 5 ++--- 20 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 assets/maps.png create mode 100644 assets/maps/205.png create mode 100644 assets/maps/404.png create mode 100644 assets/maps/aiguillon.png create mode 100644 assets/maps/alpha.png create mode 100644 assets/maps/default.png create mode 100644 assets/maps/ribbit.png create mode 100644 assets/maps/rill.png create mode 100644 assets/maps/sorona.png create mode 100644 assets/maps/starstorm.png diff --git a/assets/maps.png b/assets/maps.png deleted file mode 100644 index f0e530d..0000000 Binary files a/assets/maps.png and /dev/null differ diff --git a/assets/maps/205.png b/assets/maps/205.png new file mode 100644 index 0000000..dc4cce5 Binary files /dev/null and b/assets/maps/205.png differ diff --git a/assets/maps/404.png b/assets/maps/404.png new file mode 100644 index 0000000..e16197d Binary files /dev/null and b/assets/maps/404.png differ diff --git a/assets/maps/aiguillon.png b/assets/maps/aiguillon.png new file mode 100644 index 0000000..525a759 Binary files /dev/null and b/assets/maps/aiguillon.png differ diff --git a/assets/maps/alpha.png b/assets/maps/alpha.png new file mode 100644 index 0000000..e84bf83 Binary files /dev/null and b/assets/maps/alpha.png differ diff --git a/assets/maps/default.png b/assets/maps/default.png new file mode 100644 index 0000000..dc4cce5 Binary files /dev/null and b/assets/maps/default.png differ diff --git a/assets/maps/ribbit.png b/assets/maps/ribbit.png new file mode 100644 index 0000000..72e8e39 Binary files /dev/null and b/assets/maps/ribbit.png differ diff --git a/assets/maps/rill.png b/assets/maps/rill.png new file mode 100644 index 0000000..92f67b7 Binary files /dev/null and b/assets/maps/rill.png differ diff --git a/assets/maps/sorona.png b/assets/maps/sorona.png new file mode 100644 index 0000000..a791183 Binary files /dev/null and b/assets/maps/sorona.png differ diff --git a/assets/maps/starstorm.png b/assets/maps/starstorm.png new file mode 100644 index 0000000..581434e Binary files /dev/null and b/assets/maps/starstorm.png differ diff --git a/config/maps/205.lua b/config/maps/205.lua index d0aa1f8..a20fe0a 100644 --- a/config/maps/205.lua +++ b/config/maps/205.lua @@ -2,7 +2,7 @@ return { name = "AI Station 205", theme = "sorona.ogg", - portrait = 1, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/205.png", center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/404.lua b/config/maps/404.lua index 44b6c93..6a5b218 100644 --- a/config/maps/404.lua +++ b/config/maps/404.lua @@ -2,7 +2,7 @@ return { name = "AI Station 404", theme = "404.ogg", - portrait = 8, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/404.png", center = {x = 0, y = 0}, width = 360, height = 240, @@ -48,4 +48,4 @@ return platform = "404-small" } } -} \ No newline at end of file +} diff --git a/config/maps/aiguillon.lua b/config/maps/aiguillon.lua index c4f0ee3..e79449f 100644 --- a/config/maps/aiguillon.lua +++ b/config/maps/aiguillon.lua @@ -2,7 +2,7 @@ return { name = "Aiguillon", theme = "aiguillon.ogg", - portrait = 5, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/aiguillon.png", center = {x = 0, y = 10}, width = 370, height = 290, diff --git a/config/maps/alpha.lua b/config/maps/alpha.lua index 795b6cf..3942dde 100644 --- a/config/maps/alpha.lua +++ b/config/maps/alpha.lua @@ -2,7 +2,7 @@ return { name = "Alpha Abyss", theme = "alpha.ogg", - portrait = 7, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/alpha.png", center = {x = 0, y = -80}, width = 360, height = 240, diff --git a/config/maps/default.lua b/config/maps/default.lua index 22c03f6..76cd9d3 100644 --- a/config/maps/default.lua +++ b/config/maps/default.lua @@ -2,7 +2,7 @@ return { name = "default", theme = "default.ogg", - portrait = 1, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/default.png", center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/ribbit.lua b/config/maps/ribbit.lua index 08683ac..f5e267e 100644 --- a/config/maps/ribbit.lua +++ b/config/maps/ribbit.lua @@ -2,7 +2,7 @@ return { name = "Ribbit IV", theme = "ribbit.ogg", - portrait = 3, -- TODO: Either separate portraits now or change `iconsList` and `menu/host`. See also both mentioned files. + portrait = "assets/maps/ribbit.png", center = {x = 0, y = 50}, width = 360, height = 240, diff --git a/config/maps/rill.lua b/config/maps/rill.lua index b027923..4644ecc 100644 --- a/config/maps/rill.lua +++ b/config/maps/rill.lua @@ -2,7 +2,7 @@ return { name = "Rill", theme = "rill.ogg", - portrait = 2, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/rill.png", center = {x = 0, y = 75}, width = 400, height = 260, diff --git a/config/maps/sorona.lua b/config/maps/sorona.lua index 4cc87cd..54543c2 100644 --- a/config/maps/sorona.lua +++ b/config/maps/sorona.lua @@ -2,7 +2,7 @@ return { name = "Sorona", theme = "sorona.ogg", - portrait = 6, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/sorona.png", center = {x = 0, y = 0}, width = 360, height = 240, diff --git a/config/maps/starstorm.lua b/config/maps/starstorm.lua index b4fabcd..bb35a08 100644 --- a/config/maps/starstorm.lua +++ b/config/maps/starstorm.lua @@ -2,7 +2,7 @@ return { name = "Starstorm", theme = "starstorm.ogg", - portrait = 4, -- TODO: See `maps/ribbit`. + portrait = "assets/maps/starstorm.png", center = {x = 0, y = -20}, width = 400, height = 260, diff --git a/config/menus/host.lua b/config/menus/host.lua index c8ef4d8..571fc50 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -21,7 +21,7 @@ do local i, name = map.portrait, map.name map.filename = path if i then - table.insert(icons, love.graphics.newQuad((i-1)*76, 0, 76, 37, 608, 37)) + table.insert(icons, love.graphics.newImage(map.portrait)) table.insert(maps, map) end end @@ -35,8 +35,7 @@ return { mapSelector :setPosition(width/2-40, 40) :set("shape", Selector.SHAPE_PANORAMA) - :set("icons_quads", icons) - :set("icons_atlas", love.graphics.newImage("assets/maps.png")) + :set("icons", icons) :set("getText", function (self) return self:getSelected().name end) -- cgit v1.1 From e5ad6ac474423176f13a70ae30904aaa48365eda Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:02:03 +0200 Subject: Split portraits, menu now should use them --- assets/portraits.png | Bin 29915 -> 0 bytes assets/portraits/biker.png | Bin 0 -> 567 bytes assets/portraits/bison.png | Bin 0 -> 570 bytes assets/portraits/blblal.png | Bin 0 -> 580 bytes assets/portraits/bobito.png | Bin 0 -> 588 bytes assets/portraits/brainos.png | Bin 0 -> 524 bytes assets/portraits/bug.png | Bin 0 -> 593 bytes assets/portraits/calamari.png | Bin 0 -> 592 bytes assets/portraits/capone.png | Bin 0 -> 478 bytes assets/portraits/cowboy.png | Bin 0 -> 558 bytes assets/portraits/cowman.png | Bin 0 -> 609 bytes assets/portraits/disco.png | Bin 0 -> 567 bytes assets/portraits/dundee.png | Bin 0 -> 616 bytes assets/portraits/froggirl.png | Bin 0 -> 553 bytes assets/portraits/froggo.png | Bin 0 -> 508 bytes assets/portraits/gelato.png | Bin 0 -> 610 bytes assets/portraits/girl.png | Bin 0 -> 592 bytes assets/portraits/gramps.png | Bin 0 -> 630 bytes assets/portraits/gummybear.png | Bin 0 -> 593 bytes assets/portraits/honic.png | Bin 0 -> 484 bytes assets/portraits/joystick.png | Bin 0 -> 542 bytes assets/portraits/kong.png | Bin 0 -> 425 bytes assets/portraits/lady.png | Bin 0 -> 585 bytes assets/portraits/link.png | Bin 0 -> 610 bytes assets/portraits/marine.png | Bin 0 -> 552 bytes assets/portraits/megoman.png | Bin 0 -> 510 bytes assets/portraits/missile.png | Bin 0 -> 597 bytes assets/portraits/nemo.png | Bin 0 -> 599 bytes assets/portraits/phonebooth.png | Bin 0 -> 505 bytes assets/portraits/quack.png | Bin 0 -> 600 bytes assets/portraits/random.png | Bin 0 -> 703 bytes assets/portraits/rock.png | Bin 0 -> 2465 bytes assets/portraits/scissors.png | Bin 0 -> 621 bytes assets/portraits/scooter.png | Bin 0 -> 523 bytes assets/portraits/shutter.png | Bin 0 -> 585 bytes assets/portraits/slugzor.png | Bin 0 -> 504 bytes assets/portraits/swarm.png | Bin 0 -> 2645 bytes assets/portraits/veno.png | Bin 0 -> 575 bytes assets/portraits/vrooom.png | Bin 0 -> 560 bytes assets/portraits/weed.png | Bin 0 -> 553 bytes assets/portraits/woman.png | Bin 0 -> 560 bytes assets/portraits/yarr.png | Bin 0 -> 581 bytes config/menus/select.lua | 10 +++++----- config/nauts/biker.lua | 2 +- config/nauts/bison.lua | 2 +- config/nauts/blblal.lua | 2 +- config/nauts/bobito.lua | 2 +- config/nauts/brainos.lua | 2 +- config/nauts/bug.lua | 2 +- config/nauts/calamari.lua | 2 +- config/nauts/capone.lua | 2 +- config/nauts/cowboy.lua | 2 +- config/nauts/cowman.lua | 2 +- config/nauts/disco.lua | 2 +- config/nauts/dundee.lua | 2 +- config/nauts/froggirl.lua | 2 +- config/nauts/froggo.lua | 2 +- config/nauts/gelato.lua | 2 +- config/nauts/girl.lua | 2 +- config/nauts/gramps.lua | 2 +- config/nauts/gummybear.lua | 2 +- config/nauts/honic.lua | 2 +- config/nauts/kong.lua | 2 +- config/nauts/lady.lua | 2 +- config/nauts/link.lua | 2 +- config/nauts/marine.lua | 2 +- config/nauts/megoman.lua | 2 +- config/nauts/missile.lua | 2 +- config/nauts/nemo.lua | 2 +- config/nauts/phonebooth.lua | 2 +- config/nauts/quack.lua | 2 +- config/nauts/rock.lua | 2 +- config/nauts/scissors.lua | 2 +- config/nauts/scooter.lua | 2 +- config/nauts/shutter.lua | 2 +- config/nauts/slugzor.lua | 2 +- config/nauts/veno.lua | 2 +- config/nauts/vrooom.lua | 2 +- config/nauts/weed.lua | 2 +- config/nauts/woman.lua | 2 +- config/nauts/yarr.lua | 2 +- 81 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 assets/portraits.png create mode 100644 assets/portraits/biker.png create mode 100644 assets/portraits/bison.png create mode 100644 assets/portraits/blblal.png create mode 100644 assets/portraits/bobito.png create mode 100644 assets/portraits/brainos.png create mode 100644 assets/portraits/bug.png create mode 100644 assets/portraits/calamari.png create mode 100644 assets/portraits/capone.png create mode 100644 assets/portraits/cowboy.png create mode 100644 assets/portraits/cowman.png create mode 100644 assets/portraits/disco.png create mode 100644 assets/portraits/dundee.png create mode 100644 assets/portraits/froggirl.png create mode 100644 assets/portraits/froggo.png create mode 100644 assets/portraits/gelato.png create mode 100644 assets/portraits/girl.png create mode 100644 assets/portraits/gramps.png create mode 100644 assets/portraits/gummybear.png create mode 100644 assets/portraits/honic.png create mode 100644 assets/portraits/joystick.png create mode 100644 assets/portraits/kong.png create mode 100644 assets/portraits/lady.png create mode 100644 assets/portraits/link.png create mode 100644 assets/portraits/marine.png create mode 100644 assets/portraits/megoman.png create mode 100644 assets/portraits/missile.png create mode 100644 assets/portraits/nemo.png create mode 100644 assets/portraits/phonebooth.png create mode 100644 assets/portraits/quack.png create mode 100644 assets/portraits/random.png create mode 100644 assets/portraits/rock.png create mode 100644 assets/portraits/scissors.png create mode 100644 assets/portraits/scooter.png create mode 100644 assets/portraits/shutter.png create mode 100644 assets/portraits/slugzor.png create mode 100644 assets/portraits/swarm.png create mode 100644 assets/portraits/veno.png create mode 100644 assets/portraits/vrooom.png create mode 100644 assets/portraits/weed.png create mode 100644 assets/portraits/woman.png create mode 100644 assets/portraits/yarr.png diff --git a/assets/portraits.png b/assets/portraits.png deleted file mode 100644 index 8bb54e2..0000000 Binary files a/assets/portraits.png and /dev/null differ diff --git a/assets/portraits/biker.png b/assets/portraits/biker.png new file mode 100644 index 0000000..7f5a074 Binary files /dev/null and b/assets/portraits/biker.png differ diff --git a/assets/portraits/bison.png b/assets/portraits/bison.png new file mode 100644 index 0000000..deaf0b6 Binary files /dev/null and b/assets/portraits/bison.png differ diff --git a/assets/portraits/blblal.png b/assets/portraits/blblal.png new file mode 100644 index 0000000..ef993cd Binary files /dev/null and b/assets/portraits/blblal.png differ diff --git a/assets/portraits/bobito.png b/assets/portraits/bobito.png new file mode 100644 index 0000000..7895a52 Binary files /dev/null and b/assets/portraits/bobito.png differ diff --git a/assets/portraits/brainos.png b/assets/portraits/brainos.png new file mode 100644 index 0000000..64ce37a Binary files /dev/null and b/assets/portraits/brainos.png differ diff --git a/assets/portraits/bug.png b/assets/portraits/bug.png new file mode 100644 index 0000000..03ca682 Binary files /dev/null and b/assets/portraits/bug.png differ diff --git a/assets/portraits/calamari.png b/assets/portraits/calamari.png new file mode 100644 index 0000000..8200223 Binary files /dev/null and b/assets/portraits/calamari.png differ diff --git a/assets/portraits/capone.png b/assets/portraits/capone.png new file mode 100644 index 0000000..dc2f51b Binary files /dev/null and b/assets/portraits/capone.png differ diff --git a/assets/portraits/cowboy.png b/assets/portraits/cowboy.png new file mode 100644 index 0000000..3f6d253 Binary files /dev/null and b/assets/portraits/cowboy.png differ diff --git a/assets/portraits/cowman.png b/assets/portraits/cowman.png new file mode 100644 index 0000000..ee6ab36 Binary files /dev/null and b/assets/portraits/cowman.png differ diff --git a/assets/portraits/disco.png b/assets/portraits/disco.png new file mode 100644 index 0000000..db40314 Binary files /dev/null and b/assets/portraits/disco.png differ diff --git a/assets/portraits/dundee.png b/assets/portraits/dundee.png new file mode 100644 index 0000000..626616a Binary files /dev/null and b/assets/portraits/dundee.png differ diff --git a/assets/portraits/froggirl.png b/assets/portraits/froggirl.png new file mode 100644 index 0000000..8e60abb Binary files /dev/null and b/assets/portraits/froggirl.png differ diff --git a/assets/portraits/froggo.png b/assets/portraits/froggo.png new file mode 100644 index 0000000..1ed5095 Binary files /dev/null and b/assets/portraits/froggo.png differ diff --git a/assets/portraits/gelato.png b/assets/portraits/gelato.png new file mode 100644 index 0000000..f067bd4 Binary files /dev/null and b/assets/portraits/gelato.png differ diff --git a/assets/portraits/girl.png b/assets/portraits/girl.png new file mode 100644 index 0000000..0f1cc77 Binary files /dev/null and b/assets/portraits/girl.png differ diff --git a/assets/portraits/gramps.png b/assets/portraits/gramps.png new file mode 100644 index 0000000..f188693 Binary files /dev/null and b/assets/portraits/gramps.png differ diff --git a/assets/portraits/gummybear.png b/assets/portraits/gummybear.png new file mode 100644 index 0000000..4049860 Binary files /dev/null and b/assets/portraits/gummybear.png differ diff --git a/assets/portraits/honic.png b/assets/portraits/honic.png new file mode 100644 index 0000000..4e4d8bd Binary files /dev/null and b/assets/portraits/honic.png differ diff --git a/assets/portraits/joystick.png b/assets/portraits/joystick.png new file mode 100644 index 0000000..54cae69 Binary files /dev/null and b/assets/portraits/joystick.png differ diff --git a/assets/portraits/kong.png b/assets/portraits/kong.png new file mode 100644 index 0000000..b023be3 Binary files /dev/null and b/assets/portraits/kong.png differ diff --git a/assets/portraits/lady.png b/assets/portraits/lady.png new file mode 100644 index 0000000..4804a19 Binary files /dev/null and b/assets/portraits/lady.png differ diff --git a/assets/portraits/link.png b/assets/portraits/link.png new file mode 100644 index 0000000..20819f1 Binary files /dev/null and b/assets/portraits/link.png differ diff --git a/assets/portraits/marine.png b/assets/portraits/marine.png new file mode 100644 index 0000000..39308af Binary files /dev/null and b/assets/portraits/marine.png differ diff --git a/assets/portraits/megoman.png b/assets/portraits/megoman.png new file mode 100644 index 0000000..8973adb Binary files /dev/null and b/assets/portraits/megoman.png differ diff --git a/assets/portraits/missile.png b/assets/portraits/missile.png new file mode 100644 index 0000000..6f45f94 Binary files /dev/null and b/assets/portraits/missile.png differ diff --git a/assets/portraits/nemo.png b/assets/portraits/nemo.png new file mode 100644 index 0000000..58dd686 Binary files /dev/null and b/assets/portraits/nemo.png differ diff --git a/assets/portraits/phonebooth.png b/assets/portraits/phonebooth.png new file mode 100644 index 0000000..ac00b0c Binary files /dev/null and b/assets/portraits/phonebooth.png differ diff --git a/assets/portraits/quack.png b/assets/portraits/quack.png new file mode 100644 index 0000000..00d5936 Binary files /dev/null and b/assets/portraits/quack.png differ diff --git a/assets/portraits/random.png b/assets/portraits/random.png new file mode 100644 index 0000000..a608f32 Binary files /dev/null and b/assets/portraits/random.png differ diff --git a/assets/portraits/rock.png b/assets/portraits/rock.png new file mode 100644 index 0000000..59297db Binary files /dev/null and b/assets/portraits/rock.png differ diff --git a/assets/portraits/scissors.png b/assets/portraits/scissors.png new file mode 100644 index 0000000..4b0efb4 Binary files /dev/null and b/assets/portraits/scissors.png differ diff --git a/assets/portraits/scooter.png b/assets/portraits/scooter.png new file mode 100644 index 0000000..dd86d47 Binary files /dev/null and b/assets/portraits/scooter.png differ diff --git a/assets/portraits/shutter.png b/assets/portraits/shutter.png new file mode 100644 index 0000000..90f22f2 Binary files /dev/null and b/assets/portraits/shutter.png differ diff --git a/assets/portraits/slugzor.png b/assets/portraits/slugzor.png new file mode 100644 index 0000000..f9424e8 Binary files /dev/null and b/assets/portraits/slugzor.png differ diff --git a/assets/portraits/swarm.png b/assets/portraits/swarm.png new file mode 100644 index 0000000..e9ebe44 Binary files /dev/null and b/assets/portraits/swarm.png differ diff --git a/assets/portraits/veno.png b/assets/portraits/veno.png new file mode 100644 index 0000000..b706761 Binary files /dev/null and b/assets/portraits/veno.png differ diff --git a/assets/portraits/vrooom.png b/assets/portraits/vrooom.png new file mode 100644 index 0000000..554edb8 Binary files /dev/null and b/assets/portraits/vrooom.png differ diff --git a/assets/portraits/weed.png b/assets/portraits/weed.png new file mode 100644 index 0000000..afd4b26 Binary files /dev/null and b/assets/portraits/weed.png differ diff --git a/assets/portraits/woman.png b/assets/portraits/woman.png new file mode 100644 index 0000000..f14e787 Binary files /dev/null and b/assets/portraits/woman.png differ diff --git a/assets/portraits/yarr.png b/assets/portraits/yarr.png new file mode 100644 index 0000000..2deba58 Binary files /dev/null and b/assets/portraits/yarr.png differ diff --git a/config/menus/select.lua b/config/menus/select.lua index 0d8bef9..fb99780 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -14,7 +14,7 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: Icons for nauts and maps are still waiting to get their assets split. +-- TODO: Clean-up menus/select, menus/host and Hero after portraits split. local group, get do local atlas = love.graphics.newImage("assets/portraits.png") @@ -26,16 +26,16 @@ do local naut = love.filesystem.load(path)() local i, name = naut.portrait, naut.name if naut.available then - table.insert(icons, love.graphics.newQuad((i-1)*28, 0, 28, 27, 1176, 27)) + table.insert(icons, love.graphics.newImage(naut.portrait)) table.insert(nauts, naut) end end end -- TODO: Find a better way to add empty and random entries to naut Selector. - table.insert(icons, 1, love.graphics.newQuad((1-1)*28, 0, 28, 27, 1176, 27)) + table.insert(icons, 1, false) table.insert(nauts, 1, {name = "empty"}) - table.insert(icons, 2, love.graphics.newQuad((2-1)*28, 0, 28, 27, 1176, 27)) + table.insert(icons, 2, love.graphics.newImage("assets/portraits/random.png")) table.insert(nauts, 2, {name = "random"}) group = Group(menu) @@ -59,7 +59,7 @@ do for i,_ in pairs(Controller.getSets()) do group:addChild(Selector(nauts, group, menu)) :set("icons_atlas", atlas) - :set("icons_quads", icons) + :set("icons", icons) :set("attack", attack) :set("getText", function (self) return string.upper(self:getSelected().name) diff --git a/config/nauts/biker.lua b/config/nauts/biker.lua index c139e87..2a9fb2b 100644 --- a/config/nauts/biker.lua +++ b/config/nauts/biker.lua @@ -3,6 +3,6 @@ return { name = "biker", image = "assets/nauts/biker.png", - portrait = 30, + portrait = "assets/portraits/biker.png", available = true } diff --git a/config/nauts/bison.lua b/config/nauts/bison.lua index 35c08ca..023d9f8 100644 --- a/config/nauts/bison.lua +++ b/config/nauts/bison.lua @@ -3,6 +3,6 @@ return { name = "bison", image = "assets/nauts/bison.png", - portrait = 13, + portrait = "assets/portraits/bison.png", available = true } diff --git a/config/nauts/blblal.lua b/config/nauts/blblal.lua index 4bc9884..7be25ef 100644 --- a/config/nauts/blblal.lua +++ b/config/nauts/blblal.lua @@ -3,6 +3,6 @@ return { name = "blblal", image = "assets/nauts/blblal.png", - portrait = 40, + portrait = "assets/portraits/blblal.png", available = false } diff --git a/config/nauts/bobito.lua b/config/nauts/bobito.lua index f00fa7f..fde84ae 100644 --- a/config/nauts/bobito.lua +++ b/config/nauts/bobito.lua @@ -3,6 +3,6 @@ return { name = "bobito", image = "assets/nauts/bobito.png", - portrait = 14, + portrait = "assets/portraits/bobito.png", available = true } diff --git a/config/nauts/brainos.lua b/config/nauts/brainos.lua index 908f57a..64a94b2 100644 --- a/config/nauts/brainos.lua +++ b/config/nauts/brainos.lua @@ -3,6 +3,6 @@ return { name = "brainos", image = "assets/nauts/brainos.png", - portrait = 11, + portrait = "assets/portraits/brainos.png", available = true } diff --git a/config/nauts/bug.lua b/config/nauts/bug.lua index 3989ade..676d2fa 100644 --- a/config/nauts/bug.lua +++ b/config/nauts/bug.lua @@ -3,6 +3,6 @@ return { name = "bug", image = "assets/nauts/bug.png", - portrait = 18, + portrait = "assets/portraits/bug.png", available = true } diff --git a/config/nauts/calamari.lua b/config/nauts/calamari.lua index 3168023..ef41720 100644 --- a/config/nauts/calamari.lua +++ b/config/nauts/calamari.lua @@ -3,6 +3,6 @@ return { name = "calamari", image = "assets/nauts/calamari.png", - portrait = 19, + portrait = "assets/portraits/calamari.png", available = true } diff --git a/config/nauts/capone.lua b/config/nauts/capone.lua index edd5f35..459760f 100644 --- a/config/nauts/capone.lua +++ b/config/nauts/capone.lua @@ -3,6 +3,6 @@ return { name = "capone", image = "assets/nauts/capone.png", - portrait = 16, + portrait = "assets/portraits/capone.png", available = true } diff --git a/config/nauts/cowboy.lua b/config/nauts/cowboy.lua index d7ac120..e3e9c19 100644 --- a/config/nauts/cowboy.lua +++ b/config/nauts/cowboy.lua @@ -3,6 +3,6 @@ return { name = "cowboy", image = "assets/nauts/cowboy.png", - portrait = 4, + portrait = "assets/portraits/cowboy.png", available = true } diff --git a/config/nauts/cowman.lua b/config/nauts/cowman.lua index 5bbde57..6e2c4aa 100644 --- a/config/nauts/cowman.lua +++ b/config/nauts/cowman.lua @@ -3,6 +3,6 @@ return { name = "cowman", image = "assets/nauts/cowman.png", - portrait = 23, + portrait = "assets/portraits/cowman.png", available = true } diff --git a/config/nauts/disco.lua b/config/nauts/disco.lua index e579257..fb21110 100644 --- a/config/nauts/disco.lua +++ b/config/nauts/disco.lua @@ -3,6 +3,6 @@ return { name = "disco", image = "assets/nauts/disco.png", - portrait = 37, + portrait = "assets/portraits/disco.png", available = false } diff --git a/config/nauts/dundee.lua b/config/nauts/dundee.lua index 3299db8..e9f7c5d 100644 --- a/config/nauts/dundee.lua +++ b/config/nauts/dundee.lua @@ -3,6 +3,6 @@ return { name = "dundee", image = "assets/nauts/dundee.png", - portrait = 34, + portrait = "assets/portraits/dundee.png", available = true } diff --git a/config/nauts/froggirl.lua b/config/nauts/froggirl.lua index b587043..9734f1d 100644 --- a/config/nauts/froggirl.lua +++ b/config/nauts/froggirl.lua @@ -3,6 +3,6 @@ return { name = "froggirl", image = "assets/nauts/froggirl.png", - portrait = 33, + portrait = "assets/portraits/froggirl.png", available = true } diff --git a/config/nauts/froggo.lua b/config/nauts/froggo.lua index e1c7d85..03fc9a2 100644 --- a/config/nauts/froggo.lua +++ b/config/nauts/froggo.lua @@ -3,6 +3,6 @@ return { name = "froggo", image = "assets/nauts/froggo.png", - portrait = 3, + portrait = "assets/portraits/froggo.png", available = true } diff --git a/config/nauts/gelato.lua b/config/nauts/gelato.lua index f3f4ed5..4313fef 100644 --- a/config/nauts/gelato.lua +++ b/config/nauts/gelato.lua @@ -3,6 +3,6 @@ return { name = "gelato", image = "assets/nauts/gelato.png", - portrait = 6, + portrait = "assets/portraits/gelato.png", available = true } diff --git a/config/nauts/girl.lua b/config/nauts/girl.lua index b1d9d8a..32c7f11 100644 --- a/config/nauts/girl.lua +++ b/config/nauts/girl.lua @@ -3,6 +3,6 @@ return { name = "girl", image = "assets/nauts/girl.png", - portrait = 9, + portrait = "assets/portraits/girl.png", available = true } diff --git a/config/nauts/gramps.lua b/config/nauts/gramps.lua index 51aa672..7bf7b29 100644 --- a/config/nauts/gramps.lua +++ b/config/nauts/gramps.lua @@ -3,6 +3,6 @@ return { name = "gramps", image = "assets/nauts/gramps.png", - portrait = 29, + portrait = "assets/portraits/gramps.png", available = true } diff --git a/config/nauts/gummybear.lua b/config/nauts/gummybear.lua index a39287f..83294ed 100644 --- a/config/nauts/gummybear.lua +++ b/config/nauts/gummybear.lua @@ -3,6 +3,6 @@ return { name = "gummybear", image = "assets/nauts/gummybear.png", - portrait = 28, + portrait = "assets/portraits/gummybear.png", available = true } diff --git a/config/nauts/honic.lua b/config/nauts/honic.lua index 2ff6584..463409f 100644 --- a/config/nauts/honic.lua +++ b/config/nauts/honic.lua @@ -3,6 +3,6 @@ return { name = "honic", image = "assets/nauts/honic.png", - portrait = 5, + portrait = "assets/portraits/honic.png", available = true } diff --git a/config/nauts/kong.lua b/config/nauts/kong.lua index 731f7f1..28bcc70 100644 --- a/config/nauts/kong.lua +++ b/config/nauts/kong.lua @@ -3,6 +3,6 @@ return { name = "kong", image = "assets/nauts/kong.png", - portrait = 41, + portrait = "assets/portraits/kong.png", available = false } diff --git a/config/nauts/lady.lua b/config/nauts/lady.lua index 77ef7a3..1faf330 100644 --- a/config/nauts/lady.lua +++ b/config/nauts/lady.lua @@ -3,6 +3,6 @@ return { name = "lady", image = "assets/nauts/lady.png", - portrait = 8, + portrait = "assets/portraits/lady.png", available = true } diff --git a/config/nauts/link.lua b/config/nauts/link.lua index 1f6b430..105d543 100644 --- a/config/nauts/link.lua +++ b/config/nauts/link.lua @@ -3,6 +3,6 @@ return { name = "link", image = "assets/nauts/link.png", - portrait = 22, + portrait = "assets/portraits/link.png", available = true } diff --git a/config/nauts/marine.lua b/config/nauts/marine.lua index a0c0647..88ecbcc 100644 --- a/config/nauts/marine.lua +++ b/config/nauts/marine.lua @@ -3,6 +3,6 @@ return { name = "marine", image = "assets/nauts/marine.png", - portrait = 24, + portrait = "assets/portraits/marine.png", available = true } diff --git a/config/nauts/megoman.lua b/config/nauts/megoman.lua index 119e0fc..28e6744 100644 --- a/config/nauts/megoman.lua +++ b/config/nauts/megoman.lua @@ -3,6 +3,6 @@ return { name = "megoman", image = "assets/nauts/megoman.png", - portrait = 10, + portrait = "assets/portraits/megoman.png", available = true } diff --git a/config/nauts/missile.lua b/config/nauts/missile.lua index 5fb4d49..7c65822 100644 --- a/config/nauts/missile.lua +++ b/config/nauts/missile.lua @@ -3,6 +3,6 @@ return { name = "missile", image = "assets/nauts/missile.png", - portrait = 35, + portrait = "assets/portraits/missile.png", available = true } diff --git a/config/nauts/nemo.lua b/config/nauts/nemo.lua index fabcae6..e1d5048 100644 --- a/config/nauts/nemo.lua +++ b/config/nauts/nemo.lua @@ -3,6 +3,6 @@ return { name = "nemo", image = "assets/nauts/nemo.png", - portrait = 17, + portrait = "assets/portraits/nemo.png", available = true } diff --git a/config/nauts/phonebooth.lua b/config/nauts/phonebooth.lua index 3c1ad10..d0577ff 100644 --- a/config/nauts/phonebooth.lua +++ b/config/nauts/phonebooth.lua @@ -3,6 +3,6 @@ return { name = "phonebooth", image = "assets/nauts/phonebooth.png", - portrait = 26, + portrait = "assets/portraits/phonebooth.png", available = true } diff --git a/config/nauts/quack.lua b/config/nauts/quack.lua index e4a0d7a..6fb11ab 100644 --- a/config/nauts/quack.lua +++ b/config/nauts/quack.lua @@ -3,6 +3,6 @@ return { name = "quack", image = "assets/nauts/quack.png", - portrait = 20, + portrait = "assets/portraits/quack.png", available = true } diff --git a/config/nauts/rock.lua b/config/nauts/rock.lua index 758e62a..9a7efe4 100644 --- a/config/nauts/rock.lua +++ b/config/nauts/rock.lua @@ -3,6 +3,6 @@ return { name = "rock", image = "assets/nauts/rock.png", - portrait = 42, + portrait = "assets/portraits/rock.png", available = false } diff --git a/config/nauts/scissors.lua b/config/nauts/scissors.lua index 7526e47..0fd4e28 100644 --- a/config/nauts/scissors.lua +++ b/config/nauts/scissors.lua @@ -3,6 +3,6 @@ return { name = "scissors", image = "assets/nauts/scissors.png", - portrait = 21, + portrait = "assets/portraits/scissors.png", available = true } diff --git a/config/nauts/scooter.lua b/config/nauts/scooter.lua index 7b1a2aa..321563c 100644 --- a/config/nauts/scooter.lua +++ b/config/nauts/scooter.lua @@ -3,6 +3,6 @@ return { name = "scooter", image = "assets/nauts/scooter.png", - portrait = 25, + portrait = "assets/portraits/scooter.png", available = true } diff --git a/config/nauts/shutter.lua b/config/nauts/shutter.lua index d0e7787..40ab49b 100644 --- a/config/nauts/shutter.lua +++ b/config/nauts/shutter.lua @@ -3,6 +3,6 @@ return { name = "shutter", image = "assets/nauts/shutter.png", - portrait = 32, + portrait = "assets/portraits/shutter.png", available = true } diff --git a/config/nauts/slugzor.lua b/config/nauts/slugzor.lua index f51c5d3..7dead62 100644 --- a/config/nauts/slugzor.lua +++ b/config/nauts/slugzor.lua @@ -3,6 +3,6 @@ return { name = "slugzor", image = "assets/nauts/slugzor.png", - portrait = 15, + portrait = "assets/portraits/slugzor.png", available = true } diff --git a/config/nauts/veno.lua b/config/nauts/veno.lua index 8973173..6663a37 100644 --- a/config/nauts/veno.lua +++ b/config/nauts/veno.lua @@ -3,6 +3,6 @@ return { name = "veno", image = "assets/nauts/veno.png", - portrait = 7, + portrait = "assets/portraits/veno.png", available = true } diff --git a/config/nauts/vrooom.lua b/config/nauts/vrooom.lua index fa02a68..5d6e17f 100644 --- a/config/nauts/vrooom.lua +++ b/config/nauts/vrooom.lua @@ -3,6 +3,6 @@ return { name = "vrooom", image = "assets/nauts/vrooom.png", - portrait = 31, + portrait = "assets/portraits/vrooom.png", available = true } diff --git a/config/nauts/weed.lua b/config/nauts/weed.lua index 4c2216e..767a118 100644 --- a/config/nauts/weed.lua +++ b/config/nauts/weed.lua @@ -3,6 +3,6 @@ return { name = "weed", image = "assets/nauts/weed.png", - portrait = 27, + portrait = "assets/portraits/weed.png", available = true } diff --git a/config/nauts/woman.lua b/config/nauts/woman.lua index 88ac22e..9c12d8a 100644 --- a/config/nauts/woman.lua +++ b/config/nauts/woman.lua @@ -3,6 +3,6 @@ return { name = "woman", image = "assets/nauts/woman.png", - portrait = 12, + portrait = "assets/portraits/woman.png", available = true } diff --git a/config/nauts/yarr.lua b/config/nauts/yarr.lua index cd8e724..b471d4b 100644 --- a/config/nauts/yarr.lua +++ b/config/nauts/yarr.lua @@ -3,6 +3,6 @@ return { name = "yarr", image = "assets/nauts/yarr.png", - portrait = 39, + portrait = "assets/portraits/yarr.png", available = false } -- cgit v1.1 From 2235ec2648258bdf51c75280b2289cea0c970d0f Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:02:23 +0200 Subject: Added getIcon for Selector --- not/Selector.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/not/Selector.lua b/not/Selector.lua index ee6f0e3..5536b44 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -100,6 +100,12 @@ function Selector:getText () return tostring(self:getSelected()) end +function Selector:getIcon () + if self.icons then + return self.icons[self.index] + end +end + function Selector:focus () self.focused = true return true @@ -134,8 +140,9 @@ function Selector:draw (scale) 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`. - if self.icons_atlas and self.icons_quads then - love.graphics.draw(self.icons_atlas, self.icons_quads[self.index], (x+2)*scale, (y+3)*scale, 0, scale, scale) + local icon = self:getIcon() + if icon then + love.graphics.draw(icon, (x+2)*scale, (y+3)*scale, 0, scale, scale) end love.graphics.setColor(255, 255, 255, 255) -- cgit v1.1 From 70cd74d62d0f6d1c389a3a3ef333acb578713727 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:02:42 +0200 Subject: Hero now properly uses split-up portraits --- not/Hero.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/not/Hero.lua b/not/Hero.lua index 2549b18..30092bc 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -21,6 +21,7 @@ Hero.PUNCH_UP = {-8,-4, -8,-20, 8,-20, 8,-4} Hero.PUNCH_DOWN = {-8,4, -8,20, 8,20, 8,4} -- TODO: Portrait managment in Hero and config passed from Menu should be reviewed! +-- TODO: Clean-up, see `menus/select`. function Hero:new (config, x, y, world) local imagePath = config.image Hero.load() @@ -46,7 +47,8 @@ function Hero:new (config, x, y, world) self.isJumping = false self.spawntimer = 2 self.punchCooldown = 0 - self.portraitQuad = love.graphics.newQuad((config.portrait-1)*28, 0, 28, 27, 1176, 27) + -- TODO: Pass loaded portrait from menu to Hero. + self.portrait = love.graphics.newImage(config.portrait) self:setAnimationsList(require("config.animations.hero")) -- Post-creation self:createEffect("respawn") @@ -185,7 +187,7 @@ function Hero:drawHUD (x,y,scale,elevation) if self.isAlive then love.graphics.setColor(255,255,255,255) love.graphics.draw(self.IMAGE_FRAME, self.QUAD_FRAME, (x)*scale, (y)*scale, 0, scale, scale) - love.graphics.draw(self.IMAGE_PORTRAITS, self.portraitQuad, (x+2)*scale, (y+3)*scale, 0, scale, scale) + love.graphics.draw(self.portrait, (x+2)*scale, (y+3)*scale, 0, scale, scale) local dy = 30 * elevation love.graphics.setFont(Font) love.graphics.print((self.combo).."%",(x+2)*scale,(y-3+dy)*scale,0,scale,scale) -- cgit v1.1 From b29adf54e26d16ec7f78e9dd865bc1ce807d3f14 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:04:52 +0200 Subject: Removed obsolete attempts to load portraits atlas --- config/menus/select.lua | 2 -- not/Hero.lua | 1 - 2 files changed, 3 deletions(-) diff --git a/config/menus/select.lua b/config/menus/select.lua index fb99780..a803295 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -17,7 +17,6 @@ end -- TODO: Clean-up menus/select, menus/host and Hero after portraits split. local group, get do - local atlas = love.graphics.newImage("assets/portraits.png") local nauts, icons = {}, {} local files = love.filesystem.getDirectoryItems("config/nauts") for _,filename in pairs(files) do @@ -58,7 +57,6 @@ do for i,_ in pairs(Controller.getSets()) do group:addChild(Selector(nauts, group, menu)) - :set("icons_atlas", atlas) :set("icons", icons) :set("attack", attack) :set("getText", function (self) diff --git a/not/Hero.lua b/not/Hero.lua index 30092bc..fc5d840 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -57,7 +57,6 @@ end -- TODO: This is temporarily called by constructor. function Hero.load () if Hero.IMAGE_PORTRAITS == nil then - Hero.IMAGE_PORTRAITS = love.graphics.newImage("assets/portraits.png") Hero.IMAGE_FRAME = love.graphics.newImage("assets/menu.png") end end -- cgit v1.1 From 704fa62d2f75e9fca66d94bb809d14785178abed Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:18:18 +0200 Subject: Removed obsolete icons functions --- config/menus/host.lua | 2 +- iconsList.lua | 37 ------------------------------------- main.lua | 1 - 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 iconsList.lua diff --git a/config/menus/host.lua b/config/menus/host.lua index 571fc50..d586388 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -10,7 +10,7 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: This is temporary solution for generating available maps list and portraits for them to pass to Selector. See also: `iconsList`. +-- TODO: This is temporary solution for generating available maps list and portraits for them to pass to Selector. local icons, maps = {}, {} do local files = love.filesystem.getDirectoryItems("config/maps") diff --git a/iconsList.lua b/iconsList.lua deleted file mode 100644 index 65e4fc9..0000000 --- a/iconsList.lua +++ /dev/null @@ -1,37 +0,0 @@ --- TODO: These should be part of non-existent AssetsManager or something similar. -local function testAvoidList (i, avoidList) - for key,value in pairs(avoidList) do - if i == value then - table.remove(avoidList, key) - return false - end - end - return true -end - -function createIconsList (sheetWidth, sheetHeight, iconWidth, keysList, avoidList) - local avoidList = avoidList or {} - local iconsList, newKeysList = {}, {} - local iconsNumber = math.floor(sheetWidth / iconWidth) - local iconHeight = sheetHeight - for i=1,iconsNumber do - if testAvoidList(i, avoidList) then - iconsList[keysList[i]] = love.graphics.newQuad((i-1)*iconWidth, 0, iconWidth, iconHeight, sheetWidth, sheetHeight) - table.insert(newKeysList, keysList[i]) - end - end - return iconsList, newKeysList -end - -function getNautsIconsList (avoidList) - local avoidList = avoidList - local keysList = require "config.nauts" - local iconsList, newKeysList = createIconsList(1176, 27, 28, keysList, avoidList) - return iconsList, newKeysList -end - -function getMapsIconsList (avoidList) - local keysList = require "config.maps" - local iconsList, newKeysList = createIconsList(532, 37, 76, keysList, avoidList) - return iconsList, newKeysList -end diff --git a/main.lua b/main.lua index a71b9e2..ec56e4c 100644 --- a/main.lua +++ b/main.lua @@ -16,7 +16,6 @@ musicPlayer = require "not.MusicPlayer"() sceneManager = require "not.SceneManager"() -- Require -require "iconsList" require "not.World" require "not.Camera" require "not.Menu" -- cgit v1.1 From 86c552cab9d245b6d58638179df2ae657ef9a5db Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:22:33 +0200 Subject: Hero now holds config for World restart --- not/Hero.lua | 2 +- not/World.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/not/Hero.lua b/not/Hero.lua index fc5d840..a97a2b1 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -32,8 +32,8 @@ function Hero:new (config, x, y, world) self:setBodyFixedRotation(true) self:newFixture() -- General + self.config = config self.world = world - self.name = config.name self.angle = 0 self.facing = 1 -- Status diff --git a/not/World.lua b/not/World.lua index 4523efa..6bc5e18 100644 --- a/not/World.lua +++ b/not/World.lua @@ -468,7 +468,7 @@ function World:controlpressed (set, action, key) map.filename = filename local nauts = {} for _,naut in pairs(self:getNautsAll()) do - table.insert(nauts, {naut.name, naut:getControllerSet()}) + table.insert(nauts, {naut.config, naut:getControllerSet()}) end local new = World(map, nauts) sceneManager:changeScene(new) -- cgit v1.1 From b9f8a7bf85c88a3955d28824627a65efa193e8ad Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 19:20:30 +0200 Subject: Cleaned-up icons and items population for selectors in menu --- config/menus/host.lua | 27 ++++++++++++++------------- config/menus/select.lua | 31 ++++++++++++++++++------------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/config/menus/host.lua b/config/menus/host.lua index d586388..ce67047 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -10,24 +10,25 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: This is temporary solution for generating available maps list and portraits for them to pass to Selector. -local icons, maps = {}, {} -do - local files = love.filesystem.getDirectoryItems("config/maps") - for _,filename in pairs(files) do - local path = string.format("config/maps/%s", filename) - if love.filesystem.isFile(path) and filename ~= "readme.md" then - local map = love.filesystem.load(path)() - local i, name = map.portrait, map.name - map.filename = path - if i then - table.insert(icons, love.graphics.newImage(map.portrait)) - table.insert(maps, map) +-- TODO: loadConfigs is duplicated in menus/select and menus/host. +local +function loadConfigs (dir, process) + local items, icons = {}, {} + for _,file in pairs(love.filesystem.getDirectoryItems(dir)) do + local path = string.format("%s/%s", dir, file) + if love.filesystem.isFile(path) and file ~= "readme.md" then + local item = love.filesystem.load(path)() + if item and process(item, file, path) then + table.insert(icons, love.graphics.newImage(item.portrait)) + table.insert(items, item) end end end + return items, icons end +-- TODO: This is temporary solution for generating available maps list and portraits for them to pass to Selector. +local maps, icons = loadConfigs("config/maps", function (map, _, path) map.filename = path; return true end) local mapSelector = Selector(maps, nil, menu) return { diff --git a/config/menus/select.lua b/config/menus/select.lua index a803295..91da7c9 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -14,22 +14,27 @@ if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end --- TODO: Clean-up menus/select, menus/host and Hero after portraits split. -local group, get -do - local nauts, icons = {}, {} - local files = love.filesystem.getDirectoryItems("config/nauts") - for _,filename in pairs(files) do - local path = string.format("config/nauts/%s", filename) - if love.filesystem.isFile(path) and filename ~= "readme.md" then - local naut = love.filesystem.load(path)() - local i, name = naut.portrait, naut.name - if naut.available then - table.insert(icons, love.graphics.newImage(naut.portrait)) - table.insert(nauts, naut) +-- TODO: loadConfigs is duplicated in menus/select and menus/host. +local +function loadConfigs (dir, process) + local items, icons = {}, {} + for _,file in pairs(love.filesystem.getDirectoryItems(dir)) do + local path = string.format("%s/%s", dir, file) + if love.filesystem.isFile(path) and file ~= "readme.md" then + local item = love.filesystem.load(path)() + if item and process(item) then + table.insert(icons, love.graphics.newImage(item.portrait)) + table.insert(items, item) end end end + return items, icons +end + +-- TODO: Clean-up menus/select, menus/host and Hero after portraits split. +local group, get +do + local nauts, icons = loadConfigs("config/nauts", function (naut) return naut.available end) -- TODO: Find a better way to add empty and random entries to naut Selector. table.insert(icons, 1, false) -- cgit v1.1 From eabad160152f5bf6e7dd442de46b135a1a59f75e Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 19:38:01 +0200 Subject: Changed name of local button --- config/menus/select.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/menus/select.lua b/config/menus/select.lua index 91da7c9..6dc9d01 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -8,7 +8,7 @@ local Group = require "not.Group" local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale() local bx = width/2-29 -local start_Button = Button(menu) +local startButton = Button(menu) if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) @@ -85,7 +85,7 @@ end return { background, group, - start_Button + startButton :setText("Force start") :setPosition(bx,134) :set("isEnabled", function () @@ -123,7 +123,7 @@ return { self.the_final_countdown = 9 end if self.the_final_countdown < 0 then - start_Button:active() + startButton:active() end end) , -- cgit v1.1