summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-22 01:32:45 +0200
committerAki <nthirtyone@gmail.com>2017-09-22 01:32:45 +0200
commitdd9245c6b22f756bc439960afabf5793634c45f5 (patch)
tree15d2ba2f9de2fe545714676f4827468ad42bd1ae
parentc4524ee39e0ff90bde0df0ce7a0c14f74eeb152f (diff)
downloadroflnauts-dd9245c6b22f756bc439960afabf5793634c45f5.zip
roflnauts-dd9245c6b22f756bc439960afabf5793634c45f5.tar.gz
roflnauts-dd9245c6b22f756bc439960afabf5793634c45f5.tar.bz2
Split nauts.lua into several files now used by Hero and Menu
-rw-r--r--config/menus/select.lua32
-rw-r--r--config/nauts.lua46
-rw-r--r--config/nauts/biker.lua8
-rw-r--r--config/nauts/bison.lua8
-rw-r--r--config/nauts/blblal.lua8
-rw-r--r--config/nauts/bobito.lua8
-rw-r--r--config/nauts/brainos.lua8
-rw-r--r--config/nauts/bug.lua8
-rw-r--r--config/nauts/calamari.lua8
-rw-r--r--config/nauts/capone.lua8
-rw-r--r--config/nauts/cowboy.lua8
-rw-r--r--config/nauts/cowman.lua8
-rw-r--r--config/nauts/disco.lua8
-rw-r--r--config/nauts/dundee.lua8
-rw-r--r--config/nauts/froggirl.lua8
-rw-r--r--config/nauts/froggo.lua8
-rw-r--r--config/nauts/gelato.lua8
-rw-r--r--config/nauts/girl.lua8
-rw-r--r--config/nauts/gramps.lua8
-rw-r--r--config/nauts/gummybear.lua8
-rw-r--r--config/nauts/honic.lua8
-rw-r--r--config/nauts/joystick.lua8
-rw-r--r--config/nauts/kong.lua8
-rw-r--r--config/nauts/lady.lua8
-rw-r--r--config/nauts/link.lua8
-rw-r--r--config/nauts/marine.lua8
-rw-r--r--config/nauts/megoman.lua8
-rw-r--r--config/nauts/missile.lua8
-rw-r--r--config/nauts/nemo.lua8
-rw-r--r--config/nauts/phonebooth.lua8
-rw-r--r--config/nauts/quack.lua8
-rw-r--r--config/nauts/rock.lua8
-rw-r--r--config/nauts/scissors.lua8
-rw-r--r--config/nauts/scooter.lua8
-rw-r--r--config/nauts/shutter.lua8
-rw-r--r--config/nauts/slugzor.lua8
-rw-r--r--config/nauts/swarm.lua8
-rw-r--r--config/nauts/veno.lua8
-rw-r--r--config/nauts/vrooom.lua8
-rw-r--r--config/nauts/weed.lua8
-rw-r--r--config/nauts/woman.lua8
-rw-r--r--config/nauts/yarr.lua8
-rw-r--r--not/Hero.lua12
43 files changed, 351 insertions, 59 deletions
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)