feat: add rings

Fix #13
This commit is contained in:
Kazhnuz 2020-08-02 15:56:36 +02:00
parent 267359865e
commit e05b04357d
6 changed files with 89 additions and 1 deletions

View file

@ -27,6 +27,7 @@ local Game = Object:extend()
local Characters = require "game.characters" local Characters = require "game.characters"
local Ennemies = require "game.ennemies" local Ennemies = require "game.ennemies"
local Skills = require "game.skills" local Skills = require "game.skills"
local Loot = require "game.loot"
local binser = require "core.modules.gamesystem.libs.binser" local binser = require "core.modules.gamesystem.libs.binser"
@ -41,6 +42,7 @@ function Game:new()
self.characters = Characters(self) self.characters = Characters(self)
self.ennemies = Ennemies(self) self.ennemies = Ennemies(self)
self.skills = Skills(self) self.skills = Skills(self)
self.loot = Loot(self)
self.version = "0.0.0" self.version = "0.0.0"
end end

View file

@ -0,0 +1,31 @@
local LootManager = Object:extend()
function LootManager:new(controller)
self.controller = controller
self.rings = 0
self.inventory = {}
self.materials = {}
self.chaosDrives = {}
self.animals = {}
end
function LootManager:getData()
local data = {}
data.rings = self.rings
data.inventory = self.inventory
data.materials = self.materials
data.chaosDrives = self.chaosDrives
data.animals = self.animals
return data
end
function LootManager:setData(data)
local data = data
self.rings = data.rings
self.inventory = data.inventory
self.materials = data.materials
self.chaosDrives = data.chaosDrives
self.animals = data.animals
end
return LootManager

View file

@ -8,6 +8,7 @@ end
function GamePanel:drawContent(x, y) function GamePanel:drawContent(x, y)
local debugString = "# Save system data" .. "\n" local debugString = "# Save system data" .. "\n"
debugString = debugString .. "Current slot: " .. game.slot .. " / " .. game.slotNumber .. "\n" debugString = debugString .. "Current slot: " .. game.slot .. " / " .. game.slotNumber .. "\n"
debugString = debugString .. "Rings: " .. game.loot.rings .. "\n"
debugString = debugString .. "Gametime: " .. game:getTimeString() .. "\n" debugString = debugString .. "Gametime: " .. game:getTimeString() .. "\n"
love.graphics.print(debugString, x, y) love.graphics.print(debugString, x, y)

View file

@ -41,7 +41,11 @@ function Player:draw()
end end
function Player:drawHUD(id) function Player:drawHUD(id)
love.graphics.print(id .. " test", 4, 4) local border = 8
self.assets.images["guiRing"]:draw(border, border)
local ringString = utils.math.numberToString(game.loot.rings, 3)
self.assets.fonts["hudnbrs"]:print(ringString, border + 14, border + 1)
--love.graphics.print(id .. " test", 4, 4)
end end
return Player return Player

View file

@ -0,0 +1,49 @@
return {
["tilesets"] = {
{"charicons", "assets/sprites/characters/charicons"},
{"normaltiles", "assets/backgrounds/normaltile"},
{"sptiles", "assets/backgrounds/specialtile"},
{"borders", "assets/backgrounds/borders"},
},
["sprites"] = {
{"cursorground", "assets/gui/cursor/ground"},
{"hitGFX", "assets/sprites/gfx/hit"},
},
["textures"] = {
{"menucursor", "assets/gui/cursor-menulist.png"},
{"statusbar", "assets/gui/status_bar.png"},
{"cursorpeak", "assets/gui/cursor/peak.png"},
{"actorsShadow", "assets/sprites/shadow.png"},
{"e_speedster", "assets/gui/emblem_speedster.png"},
{"e_technic", "assets/gui/emblem_technic.png"},
{"e_power", "assets/gui/emblem_power.png"},
{"m_speedster", "assets/gui/emblem_speedster_mask.png"},
{"m_technic", "assets/gui/emblem_technic_mask.png"},
{"m_power", "assets/gui/emblem_power_mask.png"},
{"guiRing", "assets/gui/ring.png"}
},
["fonts"] = {
{"small", "assets/gui/fonts/PixelOperator.ttf", 16},
{"victory", "assets/gui/fonts/vipnagorgialla.ttf", 12}
},
["imagefonts"] = {
{"hudnbrs", "assets/gui/fonts/hudnumbers"},
{"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"},
},
["sfx"] = {
{"hit", "assets/sfx/hit.wav"},
{"hitconnect", "assets/sfx/hitconnect.wav"},
{"jump", "assets/sfx/jump.wav"},
{"woosh", "assets/sfx/woosh.wav"},
{"spincharge", "assets/sfx/spincharge.wav"},
{"spinrelease", "assets/sfx/spinrelease.wav"},
{"mBack", "assets/sfx/menus/back.wav"},
{"mBeep", "assets/sfx/menus/beep.wav"},
{"mSelect", "assets/sfx/menus/select.wav"},
{"mError", "assets/sfx/menus/error.wav"},
}
}

View file

@ -30,6 +30,7 @@ local CharsetManager = require "scenes.overworld.charsetmanager"
function MovePlayer:new() function MovePlayer:new()
MovePlayer.super.new(self) MovePlayer.super.new(self)
self.charsetManager = CharsetManager(self) self.charsetManager = CharsetManager(self)
self.assets:batchImport("scenes.overworld.assets")
World(self, "test", "map") World(self, "test", "map")
self.world:setPlayerNumber(1) self.world:setPlayerNumber(1)