parent
6f19e8dddd
commit
b28d9bf624
10 changed files with 153 additions and 4 deletions
|
@ -35,6 +35,8 @@
|
||||||
- Awakener (cure sleep)
|
- Awakener (cure sleep)
|
||||||
- Cure-All Spray (cure all status)
|
- Cure-All Spray (cure all status)
|
||||||
|
|
||||||
|
- Heal Unit (cure all status + restore all HP)
|
||||||
|
|
||||||
## Battle items
|
## Battle items
|
||||||
|
|
||||||
### Powerups
|
### Powerups
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
6
sonic-radiance.love/assets/gui/itembox.lua
Normal file
6
sonic-radiance.love/assets/gui/itembox.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
metadata = {
|
||||||
|
width = 28,
|
||||||
|
height = 29,
|
||||||
|
}
|
||||||
|
}
|
BIN
sonic-radiance.love/assets/gui/itembox.png
Normal file
BIN
sonic-radiance.love/assets/gui/itembox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
|
@ -1,7 +1,7 @@
|
||||||
return {
|
return {
|
||||||
name = "chilidog",
|
name = "chilidog",
|
||||||
fullname = "Chili Dog",
|
fullname = "Chili Dog",
|
||||||
description = "Sonic's favorite food.",
|
description = "Sonic's favorite meal, complete with jalapeños. Heal a bit",
|
||||||
conditions = {
|
conditions = {
|
||||||
{"status", "ko", false}
|
{"status", "ko", false}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,9 @@ return {
|
||||||
["sprites"] = {
|
["sprites"] = {
|
||||||
{"cursorground", "assets/gui/cursor/ground"}
|
{"cursorground", "assets/gui/cursor/ground"}
|
||||||
},
|
},
|
||||||
|
["tilesets"] = {
|
||||||
|
{"itembox", "assets/gui/itembox"}
|
||||||
|
},
|
||||||
["textures"] = {
|
["textures"] = {
|
||||||
{"menucursor", "assets/gui/cursor-menulist.png"},
|
{"menucursor", "assets/gui/cursor-menulist.png"},
|
||||||
{"statusbar", "assets/gui/status_bar.png"},
|
{"statusbar", "assets/gui/status_bar.png"},
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
return {
|
return {
|
||||||
pause = require "scenes.overworld.screens.mainmenu.pause",
|
pause = require "scenes.overworld.screens.mainmenu.pause",
|
||||||
character = require "scenes.overworld.screens.mainmenu.character"
|
character = require "scenes.overworld.screens.mainmenu.character",
|
||||||
|
items = require "scenes.overworld.screens.mainmenu.items"
|
||||||
}
|
}
|
||||||
|
|
137
sonic-radiance.love/scenes/overworld/screens/mainmenu/items.lua
Normal file
137
sonic-radiance.love/scenes/overworld/screens/mainmenu/items.lua
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
local ParentScreen = require "scenes.overworld.screens.parent"
|
||||||
|
local ItemsScreen = ParentScreen:extend()
|
||||||
|
|
||||||
|
local menu = require "game.modules.menus.list"
|
||||||
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
||||||
|
local gui = require "game.modules.gui"
|
||||||
|
|
||||||
|
local ItemWidget = menu.DualTextWidget:extend()
|
||||||
|
local BackWidget = menu.DualTextWidget:extend()
|
||||||
|
|
||||||
|
local DESC_SIZE = 48*4
|
||||||
|
|
||||||
|
function ItemsScreen:new(scene)
|
||||||
|
self.menuIndex = 1
|
||||||
|
self.choiceBack = gui.newChoiceBack(DESC_SIZE)
|
||||||
|
self.descBox = gui.newTextBox("assets/gui/dialogbox.png", DESC_SIZE, 40+16)
|
||||||
|
self.effectBox = gui.newTextBox("assets/gui/dialogbox.png", DESC_SIZE, 40)
|
||||||
|
self.desc = ""
|
||||||
|
self.effects = ""
|
||||||
|
ItemsScreen.super.new(self, scene, "Items")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:update(dt)
|
||||||
|
local keys = self.scene:getKeys(1)
|
||||||
|
if (keys["left"].isPressed) then
|
||||||
|
self:getMenu(self.menuIndex - 1)
|
||||||
|
end
|
||||||
|
if (keys["right"].isPressed) then
|
||||||
|
self:getMenu(self.menuIndex + 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:getMenu(newMenuIndex)
|
||||||
|
local newMenuIndex = newMenuIndex or 1
|
||||||
|
if (newMenuIndex > #game.loot.inventory) then
|
||||||
|
newMenuIndex = 1
|
||||||
|
end
|
||||||
|
if (newMenuIndex < 1) then
|
||||||
|
newMenuIndex = #game.loot.inventory
|
||||||
|
end
|
||||||
|
|
||||||
|
self.menuIndex = newMenuIndex
|
||||||
|
self.scene.menusystem:reset()
|
||||||
|
self:setMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:setMenu()
|
||||||
|
self.pocket = game.loot:getPocketById(self.menuIndex)
|
||||||
|
local w = 128+32
|
||||||
|
menu.ListMenu(self.scene, "menu", const.X2 - w, const.Y + 8, 128+32, 9, true)
|
||||||
|
for i,item in ipairs(self.pocket.list) do
|
||||||
|
--menu.DualTextWidget(self.scene, "menu", item.name, "x" .. item.number)
|
||||||
|
ItemWidget(self.scene, self.pocket.name, item)
|
||||||
|
end
|
||||||
|
BackWidget(self.scene)
|
||||||
|
self.scene.menusystem.menus["menu"]:setCancelWidget()
|
||||||
|
self.scene.menusystem:switchMenu("menu")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:draw()
|
||||||
|
self.scene.assets.fonts["small"]:setLineHeight(16/18)
|
||||||
|
self:drawPocket()
|
||||||
|
self:drawDescription(const.X, const.Y2 - (88+16))
|
||||||
|
self:drawEffects(const.X, const.Y2 - 40)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:drawDescription(x, y)
|
||||||
|
love.graphics.draw(self.descBox, x, y)
|
||||||
|
local xx, yy, ww = x + 6, y + 4, DESC_SIZE - 12
|
||||||
|
self.scene.assets.fonts["small"]:draw(self.desc, xx, yy, ww, "left")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:drawEffects(x, y)
|
||||||
|
love.graphics.draw(self.effectBox, x, y)
|
||||||
|
local xx, yy, ww = x + 6, y + 4, DESC_SIZE - 12
|
||||||
|
self.scene.assets.fonts["small"]:draw(self.effects, xx, yy, ww, "left")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:drawPocket()
|
||||||
|
local middleX = ((16) + (DESC_SIZE - 24)) / 2
|
||||||
|
love.graphics.draw(self.choiceBack, const.X, const.Y)
|
||||||
|
|
||||||
|
self.scene.assets.fonts["small"]:draw("<", const.X + 16, const.Y - 2, -1, "left")
|
||||||
|
self.scene.assets.fonts["small"]:draw(">", const.X + DESC_SIZE - 24, const.Y - 2, -1, "right")
|
||||||
|
self.scene.assets.fonts["small"]:draw(self.pocket.fullname, const.X + middleX, const.Y - 2, -1, "center")
|
||||||
|
|
||||||
|
self:drawPocketRoll(const.X + 48*2, const.Y + 20)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemsScreen:drawPocketRoll(x, y)
|
||||||
|
core.screen:setScissor(const.X, const.Y+ 16, 48*4, 48)
|
||||||
|
|
||||||
|
local trueX = x - ((self.menuIndex - 1) * 32)
|
||||||
|
for i, pocket in ipairs(game.loot.inventory) do
|
||||||
|
local trueIndex = i - self.menuIndex
|
||||||
|
if (trueIndex > 4) then
|
||||||
|
trueIndex = trueIndex - 8
|
||||||
|
end
|
||||||
|
if (trueIndex < -4) then
|
||||||
|
trueIndex = trueIndex + 8
|
||||||
|
end
|
||||||
|
if (trueIndex ~= 0) then
|
||||||
|
love.graphics.setColor(.3, .3, .3, .6)
|
||||||
|
end
|
||||||
|
self.scene.assets.tileset["itembox"]:drawTile(i, x + ((trueIndex)*32), y, 0, 1, 1, 14, 0)
|
||||||
|
utils.graphics.resetColor()
|
||||||
|
end
|
||||||
|
|
||||||
|
core.screen:resetScissor()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Widgets
|
||||||
|
function ItemWidget:new(scene, pocket, item)
|
||||||
|
self.item = item
|
||||||
|
self.itemData = game.loot:getItemData(pocket, self.item.name)
|
||||||
|
ItemWidget.super.new(self, scene, "menu", self.itemData.fullname, "x" .. self.item.number)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ItemWidget:selectAction()
|
||||||
|
self.scene.currentScreen.desc = self.itemData.description
|
||||||
|
end
|
||||||
|
|
||||||
|
--BackWidget
|
||||||
|
function BackWidget:new(scene)
|
||||||
|
ItemWidget.super.new(self, scene, "menu", "Back", "")
|
||||||
|
end
|
||||||
|
|
||||||
|
function BackWidget:selectAction()
|
||||||
|
self.scene.currentScreen.desc = ""
|
||||||
|
self.scene.currentScreen.effects = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function BackWidget:action()
|
||||||
|
self.scene.screens.mainmenu["pause"](self.scene, "main", 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
return ItemsScreen
|
|
@ -30,7 +30,7 @@ function PauseScreen:setMenu()
|
||||||
menu.FancyMenu(self.scene, "main", const.X, const.Y, 108, 10, false)
|
menu.FancyMenu(self.scene, "main", const.X, const.Y, 108, 10, false)
|
||||||
TeamWidget(self.scene)
|
TeamWidget(self.scene)
|
||||||
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
||||||
menu.BaseWidget(self.scene, "main", "Items", ">")
|
ViewWidget(self.scene, "Items", "items")
|
||||||
menu.BaseWidget(self.scene, "main", "Chao", ">")
|
menu.BaseWidget(self.scene, "main", "Chao", ">")
|
||||||
menu.BaseWidget(self.scene, "main", "Encylopedia", ">")
|
menu.BaseWidget(self.scene, "main", "Encylopedia", ">")
|
||||||
menu.BaseWidget(self.scene, "main", "Options", ">")
|
menu.BaseWidget(self.scene, "main", "Options", ">")
|
||||||
|
|
|
@ -30,7 +30,7 @@ end
|
||||||
|
|
||||||
function MenuScreenParent:drawForeground()
|
function MenuScreenParent:drawForeground()
|
||||||
self.scene.assets.fonts["SA2font"]:print(self.title, 160, 12)
|
self.scene.assets.fonts["SA2font"]:print(self.title, 160, 12)
|
||||||
--love.graphics.rectangle("line", const.X, const.Y, const.WIDTH, const.HEIGHT)
|
love.graphics.rectangle("line", const.X, const.Y, const.WIDTH, const.HEIGHT)
|
||||||
self:draw()
|
self:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue