diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-22 19:38:39 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-22 19:38:39 +0200 |
commit | 6d530ace4d6a445d3136cca180f54f8add3d81fc (patch) | |
tree | 0dd6d7b0ffe24a8f9962d71ef6c3bfc572871ce1 | |
parent | c4524ee39e0ff90bde0df0ce7a0c14f74eeb152f (diff) | |
parent | eabad160152f5bf6e7dd442de46b135a1a59f75e (diff) | |
download | roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.zip roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.tar.gz roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.tar.bz2 |
Merge branch 'icons'
109 files changed, 398 insertions, 133 deletions
diff --git a/assets/maps.png b/assets/maps.png Binary files differdeleted file mode 100644 index f0e530d..0000000 --- a/assets/maps.png +++ /dev/null diff --git a/assets/maps/205.png b/assets/maps/205.png Binary files differnew file mode 100644 index 0000000..dc4cce5 --- /dev/null +++ b/assets/maps/205.png diff --git a/assets/maps/404.png b/assets/maps/404.png Binary files differnew file mode 100644 index 0000000..e16197d --- /dev/null +++ b/assets/maps/404.png diff --git a/assets/maps/aiguillon.png b/assets/maps/aiguillon.png Binary files differnew file mode 100644 index 0000000..525a759 --- /dev/null +++ b/assets/maps/aiguillon.png diff --git a/assets/maps/alpha.png b/assets/maps/alpha.png Binary files differnew file mode 100644 index 0000000..e84bf83 --- /dev/null +++ b/assets/maps/alpha.png diff --git a/assets/maps/default.png b/assets/maps/default.png Binary files differnew file mode 100644 index 0000000..dc4cce5 --- /dev/null +++ b/assets/maps/default.png diff --git a/assets/maps/ribbit.png b/assets/maps/ribbit.png Binary files differnew file mode 100644 index 0000000..72e8e39 --- /dev/null +++ b/assets/maps/ribbit.png diff --git a/assets/maps/rill.png b/assets/maps/rill.png Binary files differnew file mode 100644 index 0000000..92f67b7 --- /dev/null +++ b/assets/maps/rill.png diff --git a/assets/maps/sorona.png b/assets/maps/sorona.png Binary files differnew file mode 100644 index 0000000..a791183 --- /dev/null +++ b/assets/maps/sorona.png diff --git a/assets/maps/starstorm.png b/assets/maps/starstorm.png Binary files differnew file mode 100644 index 0000000..581434e --- /dev/null +++ b/assets/maps/starstorm.png diff --git a/assets/portraits.png b/assets/portraits.png Binary files differdeleted file mode 100644 index 8bb54e2..0000000 --- a/assets/portraits.png +++ /dev/null diff --git a/assets/portraits/biker.png b/assets/portraits/biker.png Binary files differnew file mode 100644 index 0000000..7f5a074 --- /dev/null +++ b/assets/portraits/biker.png diff --git a/assets/portraits/bison.png b/assets/portraits/bison.png Binary files differnew file mode 100644 index 0000000..deaf0b6 --- /dev/null +++ b/assets/portraits/bison.png diff --git a/assets/portraits/blblal.png b/assets/portraits/blblal.png Binary files differnew file mode 100644 index 0000000..ef993cd --- /dev/null +++ b/assets/portraits/blblal.png diff --git a/assets/portraits/bobito.png b/assets/portraits/bobito.png Binary files differnew file mode 100644 index 0000000..7895a52 --- /dev/null +++ b/assets/portraits/bobito.png diff --git a/assets/portraits/brainos.png b/assets/portraits/brainos.png Binary files differnew file mode 100644 index 0000000..64ce37a --- /dev/null +++ b/assets/portraits/brainos.png diff --git a/assets/portraits/bug.png b/assets/portraits/bug.png Binary files differnew file mode 100644 index 0000000..03ca682 --- /dev/null +++ b/assets/portraits/bug.png diff --git a/assets/portraits/calamari.png b/assets/portraits/calamari.png Binary files differnew file mode 100644 index 0000000..8200223 --- /dev/null +++ b/assets/portraits/calamari.png diff --git a/assets/portraits/capone.png b/assets/portraits/capone.png Binary files differnew file mode 100644 index 0000000..dc2f51b --- /dev/null +++ b/assets/portraits/capone.png diff --git a/assets/portraits/cowboy.png b/assets/portraits/cowboy.png Binary files differnew file mode 100644 index 0000000..3f6d253 --- /dev/null +++ b/assets/portraits/cowboy.png diff --git a/assets/portraits/cowman.png b/assets/portraits/cowman.png Binary files differnew file mode 100644 index 0000000..ee6ab36 --- /dev/null +++ b/assets/portraits/cowman.png diff --git a/assets/portraits/disco.png b/assets/portraits/disco.png Binary files differnew file mode 100644 index 0000000..db40314 --- /dev/null +++ b/assets/portraits/disco.png diff --git a/assets/portraits/dundee.png b/assets/portraits/dundee.png Binary files differnew file mode 100644 index 0000000..626616a --- /dev/null +++ b/assets/portraits/dundee.png diff --git a/assets/portraits/froggirl.png b/assets/portraits/froggirl.png Binary files differnew file mode 100644 index 0000000..8e60abb --- /dev/null +++ b/assets/portraits/froggirl.png diff --git a/assets/portraits/froggo.png b/assets/portraits/froggo.png Binary files differnew file mode 100644 index 0000000..1ed5095 --- /dev/null +++ b/assets/portraits/froggo.png diff --git a/assets/portraits/gelato.png b/assets/portraits/gelato.png Binary files differnew file mode 100644 index 0000000..f067bd4 --- /dev/null +++ b/assets/portraits/gelato.png diff --git a/assets/portraits/girl.png b/assets/portraits/girl.png Binary files differnew file mode 100644 index 0000000..0f1cc77 --- /dev/null +++ b/assets/portraits/girl.png diff --git a/assets/portraits/gramps.png b/assets/portraits/gramps.png Binary files differnew file mode 100644 index 0000000..f188693 --- /dev/null +++ b/assets/portraits/gramps.png diff --git a/assets/portraits/gummybear.png b/assets/portraits/gummybear.png Binary files differnew file mode 100644 index 0000000..4049860 --- /dev/null +++ b/assets/portraits/gummybear.png diff --git a/assets/portraits/honic.png b/assets/portraits/honic.png Binary files differnew file mode 100644 index 0000000..4e4d8bd --- /dev/null +++ b/assets/portraits/honic.png diff --git a/assets/portraits/joystick.png b/assets/portraits/joystick.png Binary files differnew file mode 100644 index 0000000..54cae69 --- /dev/null +++ b/assets/portraits/joystick.png diff --git a/assets/portraits/kong.png b/assets/portraits/kong.png Binary files differnew file mode 100644 index 0000000..b023be3 --- /dev/null +++ b/assets/portraits/kong.png diff --git a/assets/portraits/lady.png b/assets/portraits/lady.png Binary files differnew file mode 100644 index 0000000..4804a19 --- /dev/null +++ b/assets/portraits/lady.png diff --git a/assets/portraits/link.png b/assets/portraits/link.png Binary files differnew file mode 100644 index 0000000..20819f1 --- /dev/null +++ b/assets/portraits/link.png diff --git a/assets/portraits/marine.png b/assets/portraits/marine.png Binary files differnew file mode 100644 index 0000000..39308af --- /dev/null +++ b/assets/portraits/marine.png diff --git a/assets/portraits/megoman.png b/assets/portraits/megoman.png Binary files differnew file mode 100644 index 0000000..8973adb --- /dev/null +++ b/assets/portraits/megoman.png diff --git a/assets/portraits/missile.png b/assets/portraits/missile.png Binary files differnew file mode 100644 index 0000000..6f45f94 --- /dev/null +++ b/assets/portraits/missile.png diff --git a/assets/portraits/nemo.png b/assets/portraits/nemo.png Binary files differnew file mode 100644 index 0000000..58dd686 --- /dev/null +++ b/assets/portraits/nemo.png diff --git a/assets/portraits/phonebooth.png b/assets/portraits/phonebooth.png Binary files differnew file mode 100644 index 0000000..ac00b0c --- /dev/null +++ b/assets/portraits/phonebooth.png diff --git a/assets/portraits/quack.png b/assets/portraits/quack.png Binary files differnew file mode 100644 index 0000000..00d5936 --- /dev/null +++ b/assets/portraits/quack.png diff --git a/assets/portraits/random.png b/assets/portraits/random.png Binary files differnew file mode 100644 index 0000000..a608f32 --- /dev/null +++ b/assets/portraits/random.png diff --git a/assets/portraits/rock.png b/assets/portraits/rock.png Binary files differnew file mode 100644 index 0000000..59297db --- /dev/null +++ b/assets/portraits/rock.png diff --git a/assets/portraits/scissors.png b/assets/portraits/scissors.png Binary files differnew file mode 100644 index 0000000..4b0efb4 --- /dev/null +++ b/assets/portraits/scissors.png diff --git a/assets/portraits/scooter.png b/assets/portraits/scooter.png Binary files differnew file mode 100644 index 0000000..dd86d47 --- /dev/null +++ b/assets/portraits/scooter.png diff --git a/assets/portraits/shutter.png b/assets/portraits/shutter.png Binary files differnew file mode 100644 index 0000000..90f22f2 --- /dev/null +++ b/assets/portraits/shutter.png diff --git a/assets/portraits/slugzor.png b/assets/portraits/slugzor.png Binary files differnew file mode 100644 index 0000000..f9424e8 --- /dev/null +++ b/assets/portraits/slugzor.png diff --git a/assets/portraits/swarm.png b/assets/portraits/swarm.png Binary files differnew file mode 100644 index 0000000..e9ebe44 --- /dev/null +++ b/assets/portraits/swarm.png diff --git a/assets/portraits/veno.png b/assets/portraits/veno.png Binary files differnew file mode 100644 index 0000000..b706761 --- /dev/null +++ b/assets/portraits/veno.png diff --git a/assets/portraits/vrooom.png b/assets/portraits/vrooom.png Binary files differnew file mode 100644 index 0000000..554edb8 --- /dev/null +++ b/assets/portraits/vrooom.png diff --git a/assets/portraits/weed.png b/assets/portraits/weed.png Binary files differnew file mode 100644 index 0000000..afd4b26 --- /dev/null +++ b/assets/portraits/weed.png diff --git a/assets/portraits/woman.png b/assets/portraits/woman.png Binary files differnew file mode 100644 index 0000000..f14e787 --- /dev/null +++ b/assets/portraits/woman.png diff --git a/assets/portraits/yarr.png b/assets/portraits/yarr.png Binary files differnew file mode 100644 index 0000000..2deba58 --- /dev/null +++ b/assets/portraits/yarr.png 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..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. See also: `iconsList`. -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.newQuad((i-1)*76, 0, 76, 37, 608, 37)) - 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 { @@ -35,8 +36,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) diff --git a/config/menus/select.lua b/config/menus/select.lua index fee7c94..6dc9d01 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -8,31 +8,50 @@ 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) end --- TODO: Temporary group for naut selectors. This isn't production code at any means! +-- 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 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)) - end + 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) + table.insert(nauts, 1, {name = "empty"}) + table.insert(icons, 2, love.graphics.newImage("assets/portraits/random.png")) + 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 @@ -43,9 +62,11 @@ 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) + end) end group:set("margin", 16) @@ -64,7 +85,7 @@ end return { background, group, - start_Button + startButton :setText("Force start") :setPosition(bx,134) :set("isEnabled", function () @@ -102,7 +123,7 @@ return { self.the_final_countdown = 9 end if self.the_final_countdown < 0 then - start_Button:active() + startButton:active() end end) , 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..2a9fb2b --- /dev/null +++ b/config/nauts/biker.lua @@ -0,0 +1,8 @@ +--- chucho +return +{ + name = "biker", + image = "assets/nauts/biker.png", + portrait = "assets/portraits/biker.png", + available = true +} diff --git a/config/nauts/bison.lua b/config/nauts/bison.lua new file mode 100644 index 0000000..023d9f8 --- /dev/null +++ b/config/nauts/bison.lua @@ -0,0 +1,8 @@ +--- skolldir +return +{ + name = "bison", + image = "assets/nauts/bison.png", + portrait = "assets/portraits/bison.png", + available = true +} diff --git a/config/nauts/blblal.lua b/config/nauts/blblal.lua new file mode 100644 index 0000000..7be25ef --- /dev/null +++ b/config/nauts/blblal.lua @@ -0,0 +1,8 @@ +--- blabl zork +return +{ + name = "blblal", + image = "assets/nauts/blblal.png", + portrait = "assets/portraits/blblal.png", + available = false +} diff --git a/config/nauts/bobito.lua b/config/nauts/bobito.lua new file mode 100644 index 0000000..fde84ae --- /dev/null +++ b/config/nauts/bobito.lua @@ -0,0 +1,8 @@ +--- yuri +return +{ + name = "bobito", + image = "assets/nauts/bobito.png", + portrait = "assets/portraits/bobito.png", + available = true +} diff --git a/config/nauts/brainos.lua b/config/nauts/brainos.lua new file mode 100644 index 0000000..64a94b2 --- /dev/null +++ b/config/nauts/brainos.lua @@ -0,0 +1,8 @@ +--- voltar +return +{ + name = "brainos", + image = "assets/nauts/brainos.png", + portrait = "assets/portraits/brainos.png", + available = true +} diff --git a/config/nauts/bug.lua b/config/nauts/bug.lua new file mode 100644 index 0000000..676d2fa --- /dev/null +++ b/config/nauts/bug.lua @@ -0,0 +1,8 @@ +--- genji +return +{ + name = "bug", + image = "assets/nauts/bug.png", + portrait = "assets/portraits/bug.png", + available = true +} diff --git a/config/nauts/calamari.lua b/config/nauts/calamari.lua new file mode 100644 index 0000000..ef41720 --- /dev/null +++ b/config/nauts/calamari.lua @@ -0,0 +1,8 @@ +--- swiggins +return +{ + name = "calamari", + image = "assets/nauts/calamari.png", + portrait = "assets/portraits/calamari.png", + available = true +} diff --git a/config/nauts/capone.lua b/config/nauts/capone.lua new file mode 100644 index 0000000..459760f --- /dev/null +++ b/config/nauts/capone.lua @@ -0,0 +1,8 @@ +--- vinnie +return +{ + name = "capone", + image = "assets/nauts/capone.png", + portrait = "assets/portraits/capone.png", + available = true +} diff --git a/config/nauts/cowboy.lua b/config/nauts/cowboy.lua new file mode 100644 index 0000000..e3e9c19 --- /dev/null +++ b/config/nauts/cowboy.lua @@ -0,0 +1,8 @@ +--- lonestar +return +{ + name = "cowboy", + image = "assets/nauts/cowboy.png", + portrait = "assets/portraits/cowboy.png", + available = true +} diff --git a/config/nauts/cowman.lua b/config/nauts/cowman.lua new file mode 100644 index 0000000..6e2c4aa --- /dev/null +++ b/config/nauts/cowman.lua @@ -0,0 +1,8 @@ +--- deadlift +return +{ + name = "cowman", + image = "assets/nauts/cowman.png", + portrait = "assets/portraits/cowman.png", + available = true +} diff --git a/config/nauts/disco.lua b/config/nauts/disco.lua new file mode 100644 index 0000000..fb21110 --- /dev/null +++ b/config/nauts/disco.lua @@ -0,0 +1,8 @@ +--- esc rocco +return +{ + name = "disco", + image = "assets/nauts/disco.png", + portrait = "assets/portraits/disco.png", + available = false +} diff --git a/config/nauts/dundee.lua b/config/nauts/dundee.lua new file mode 100644 index 0000000..e9f7c5d --- /dev/null +++ b/config/nauts/dundee.lua @@ -0,0 +1,8 @@ +--- smiles +return +{ + name = "dundee", + image = "assets/nauts/dundee.png", + portrait = "assets/portraits/dundee.png", + available = true +} diff --git a/config/nauts/froggirl.lua b/config/nauts/froggirl.lua new file mode 100644 index 0000000..9734f1d --- /dev/null +++ b/config/nauts/froggirl.lua @@ -0,0 +1,8 @@ +--- dizzy +return +{ + name = "froggirl", + image = "assets/nauts/froggirl.png", + portrait = "assets/portraits/froggirl.png", + available = true +} diff --git a/config/nauts/froggo.lua b/config/nauts/froggo.lua new file mode 100644 index 0000000..03fc9a2 --- /dev/null +++ b/config/nauts/froggo.lua @@ -0,0 +1,8 @@ +--- froggy +return +{ + name = "froggo", + image = "assets/nauts/froggo.png", + portrait = "assets/portraits/froggo.png", + available = true +} diff --git a/config/nauts/gelato.lua b/config/nauts/gelato.lua new file mode 100644 index 0000000..4313fef --- /dev/null +++ b/config/nauts/gelato.lua @@ -0,0 +1,8 @@ +--- scoop +return +{ + name = "gelato", + image = "assets/nauts/gelato.png", + portrait = "assets/portraits/gelato.png", + available = true +} diff --git a/config/nauts/girl.lua b/config/nauts/girl.lua new file mode 100644 index 0000000..32c7f11 --- /dev/null +++ b/config/nauts/girl.lua @@ -0,0 +1,8 @@ +--- ayla +return +{ + name = "girl", + image = "assets/nauts/girl.png", + portrait = "assets/portraits/girl.png", + available = true +} diff --git a/config/nauts/gramps.lua b/config/nauts/gramps.lua new file mode 100644 index 0000000..7bf7b29 --- /dev/null +++ b/config/nauts/gramps.lua @@ -0,0 +1,8 @@ +--- yoolip +return +{ + name = "gramps", + image = "assets/nauts/gramps.png", + portrait = "assets/portraits/gramps.png", + available = true +} diff --git a/config/nauts/gummybear.lua b/config/nauts/gummybear.lua new file mode 100644 index 0000000..83294ed --- /dev/null +++ b/config/nauts/gummybear.lua @@ -0,0 +1,8 @@ +--- nibbs +return +{ + name = "gummybear", + image = "assets/nauts/gummybear.png", + portrait = "assets/portraits/gummybear.png", + available = true +} diff --git a/config/nauts/honic.lua b/config/nauts/honic.lua new file mode 100644 index 0000000..463409f --- /dev/null +++ b/config/nauts/honic.lua @@ -0,0 +1,8 @@ +--- leon +return +{ + name = "honic", + image = "assets/nauts/honic.png", + portrait = "assets/portraits/honic.png", + 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..28bcc70 --- /dev/null +++ b/config/nauts/kong.lua @@ -0,0 +1,8 @@ +--- ronimo +return +{ + name = "kong", + image = "assets/nauts/kong.png", + portrait = "assets/portraits/kong.png", + available = false +} diff --git a/config/nauts/lady.lua b/config/nauts/lady.lua new file mode 100644 index 0000000..1faf330 --- /dev/null +++ b/config/nauts/lady.lua @@ -0,0 +1,8 @@ +--- raelynn +return +{ + name = "lady", + image = "assets/nauts/lady.png", + portrait = "assets/portraits/lady.png", + available = true +} diff --git a/config/nauts/link.lua b/config/nauts/link.lua new file mode 100644 index 0000000..105d543 --- /dev/null +++ b/config/nauts/link.lua @@ -0,0 +1,8 @@ +--- ix +return +{ + name = "link", + image = "assets/nauts/link.png", + portrait = "assets/portraits/link.png", + available = true +} diff --git a/config/nauts/marine.lua b/config/nauts/marine.lua new file mode 100644 index 0000000..88ecbcc --- /dev/null +++ b/config/nauts/marine.lua @@ -0,0 +1,8 @@ +--- ted +return +{ + name = "marine", + image = "assets/nauts/marine.png", + portrait = "assets/portraits/marine.png", + available = true +} diff --git a/config/nauts/megoman.lua b/config/nauts/megoman.lua new file mode 100644 index 0000000..28e6744 --- /dev/null +++ b/config/nauts/megoman.lua @@ -0,0 +1,8 @@ +--- clunk +return +{ + name = "megoman", + image = "assets/nauts/megoman.png", + portrait = "assets/portraits/megoman.png", + available = true +} diff --git a/config/nauts/missile.lua b/config/nauts/missile.lua new file mode 100644 index 0000000..7c65822 --- /dev/null +++ b/config/nauts/missile.lua @@ -0,0 +1,8 @@ +--- commander rocket +return +{ + name = "missile", + image = "assets/nauts/missile.png", + portrait = "assets/portraits/missile.png", + available = true +} diff --git a/config/nauts/nemo.lua b/config/nauts/nemo.lua new file mode 100644 index 0000000..e1d5048 --- /dev/null +++ b/config/nauts/nemo.lua @@ -0,0 +1,8 @@ +--- spike +return +{ + name = "nemo", + image = "assets/nauts/nemo.png", + portrait = "assets/portraits/nemo.png", + available = true +} diff --git a/config/nauts/phonebooth.lua b/config/nauts/phonebooth.lua new file mode 100644 index 0000000..d0577ff --- /dev/null +++ b/config/nauts/phonebooth.lua @@ -0,0 +1,8 @@ +--- sentry +return +{ + name = "phonebooth", + image = "assets/nauts/phonebooth.png", + portrait = "assets/portraits/phonebooth.png", + available = true +} diff --git a/config/nauts/quack.lua b/config/nauts/quack.lua new file mode 100644 index 0000000..6fb11ab --- /dev/null +++ b/config/nauts/quack.lua @@ -0,0 +1,8 @@ +--- rocco +return +{ + name = "quack", + image = "assets/nauts/quack.png", + portrait = "assets/portraits/quack.png", + available = true +} diff --git a/config/nauts/rock.lua b/config/nauts/rock.lua new file mode 100644 index 0000000..9a7efe4 --- /dev/null +++ b/config/nauts/rock.lua @@ -0,0 +1,8 @@ +--- rock +return +{ + name = "rock", + image = "assets/nauts/rock.png", + portrait = "assets/portraits/rock.png", + available = false +} diff --git a/config/nauts/scissors.lua b/config/nauts/scissors.lua new file mode 100644 index 0000000..0fd4e28 --- /dev/null +++ b/config/nauts/scissors.lua @@ -0,0 +1,8 @@ +--- ksenia +return +{ + name = "scissors", + image = "assets/nauts/scissors.png", + portrait = "assets/portraits/scissors.png", + available = true +} diff --git a/config/nauts/scooter.lua b/config/nauts/scooter.lua new file mode 100644 index 0000000..321563c --- /dev/null +++ b/config/nauts/scooter.lua @@ -0,0 +1,8 @@ +--- penny +return +{ + name = "scooter", + image = "assets/nauts/scooter.png", + portrait = "assets/portraits/scooter.png", + available = true +} diff --git a/config/nauts/shutter.lua b/config/nauts/shutter.lua new file mode 100644 index 0000000..40ab49b --- /dev/null +++ b/config/nauts/shutter.lua @@ -0,0 +1,8 @@ +--- max +return +{ + name = "shutter", + image = "assets/nauts/shutter.png", + portrait = "assets/portraits/shutter.png", + available = true +} diff --git a/config/nauts/slugzor.lua b/config/nauts/slugzor.lua new file mode 100644 index 0000000..7dead62 --- /dev/null +++ b/config/nauts/slugzor.lua @@ -0,0 +1,8 @@ +--- derpl +return +{ + name = "slugzor", + image = "assets/nauts/slugzor.png", + portrait = "assets/portraits/slugzor.png", + 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..6663a37 --- /dev/null +++ b/config/nauts/veno.lua @@ -0,0 +1,8 @@ +--- gnaw +return +{ + name = "veno", + image = "assets/nauts/veno.png", + portrait = "assets/portraits/veno.png", + available = true +} diff --git a/config/nauts/vrooom.lua b/config/nauts/vrooom.lua new file mode 100644 index 0000000..5d6e17f --- /dev/null +++ b/config/nauts/vrooom.lua @@ -0,0 +1,8 @@ +--- lux +return +{ + name = "vrooom", + image = "assets/nauts/vrooom.png", + portrait = "assets/portraits/vrooom.png", + available = true +} diff --git a/config/nauts/weed.lua b/config/nauts/weed.lua new file mode 100644 index 0000000..767a118 --- /dev/null +++ b/config/nauts/weed.lua @@ -0,0 +1,8 @@ +--- skree +return +{ + name = "weed", + image = "assets/nauts/weed.png", + portrait = "assets/portraits/weed.png", + available = true +} diff --git a/config/nauts/woman.lua b/config/nauts/woman.lua new file mode 100644 index 0000000..9c12d8a --- /dev/null +++ b/config/nauts/woman.lua @@ -0,0 +1,8 @@ +--- coco +return +{ + name = "woman", + image = "assets/nauts/woman.png", + portrait = "assets/portraits/woman.png", + available = true +} diff --git a/config/nauts/yarr.lua b/config/nauts/yarr.lua new file mode 100644 index 0000000..b471d4b --- /dev/null +++ b/config/nauts/yarr.lua @@ -0,0 +1,8 @@ +--- ted pirate +return +{ + name = "yarr", + image = "assets/nauts/yarr.png", + portrait = "assets/portraits/yarr.png", + available = false +} 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 @@ -16,7 +16,6 @@ musicPlayer = require "not.MusicPlayer"() sceneManager = require "not.SceneManager"() -- Require -require "iconsList" require "not.World" require "not.Camera" require "not.Menu" diff --git a/not/Hero.lua b/not/Hero.lua index 66bc511..a97a2b1 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,10 @@ 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! +-- TODO: Clean-up, see `menus/select`. +function Hero:new (config, x, y, world) + local imagePath = config.image Hero.load() Hero.__super.new(self, x, y, world, imagePath) -- Physics @@ -32,8 +32,8 @@ function Hero:new (name, x, y, world) self:setBodyFixedRotation(true) self:newFixture() -- General + self.config = config self.world = world - self.name = name self.angle = 0 self.facing = 1 -- Status @@ -47,6 +47,8 @@ function Hero:new (name, x, y, world) self.isJumping = false self.spawntimer = 2 self.punchCooldown = 0 + -- 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") @@ -55,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 @@ -185,7 +186,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.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) 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) 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) |