parent
93254fefa1
commit
70029ba7bd
5 changed files with 181 additions and 11 deletions
|
@ -8,8 +8,8 @@ return {
|
|||
height = 40,
|
||||
tilewidth = 16,
|
||||
tileheight = 16,
|
||||
nextlayerid = 7,
|
||||
nextobjectid = 19,
|
||||
nextlayerid = 8,
|
||||
nextobjectid = 21,
|
||||
properties = {},
|
||||
tilesets = {
|
||||
{
|
||||
|
@ -316,6 +316,42 @@ return {
|
|||
id = 102,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 108,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 109,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 110,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 116,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 117,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 118,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 124,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 125,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 126,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 129,
|
||||
type = "solid"
|
||||
|
@ -323,6 +359,54 @@ return {
|
|||
{
|
||||
id = 130,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 132,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 133,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 134,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 140,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 141,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 142,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 148,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 149,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 150,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 156,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 157,
|
||||
type = "solid"
|
||||
},
|
||||
{
|
||||
id = 158,
|
||||
type = "solid"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -660,9 +744,21 @@ return {
|
|||
offsetx = 0,
|
||||
offsety = 0,
|
||||
properties = {},
|
||||
objects = {}
|
||||
},
|
||||
{
|
||||
type = "objectgroup",
|
||||
draworder = "topdown",
|
||||
id = 7,
|
||||
name = "pnj",
|
||||
visible = true,
|
||||
opacity = 1,
|
||||
offsetx = 0,
|
||||
offsety = 0,
|
||||
properties = {},
|
||||
objects = {
|
||||
{
|
||||
id = 16,
|
||||
id = 20,
|
||||
name = "",
|
||||
type = "",
|
||||
shape = "rectangle",
|
||||
|
@ -676,7 +772,17 @@ return {
|
|||
["charDir"] = "right",
|
||||
["charId"] = 5,
|
||||
["charset"] = "perso",
|
||||
["isSolid"] = true
|
||||
["isSolid"] = true,
|
||||
["message1"] = "Sonic, you should stop doing stupid stuff and focus on defeating badnics.",
|
||||
["message2"] = "What did I say ? Stop fooling around.",
|
||||
["message4"] = "Seriously Sonic ?",
|
||||
["message5"] = "STOP. TALKING.",
|
||||
["message6"] = "You'll do the whole list of message, don't you ?",
|
||||
["message7"] = "...",
|
||||
["message8"] = "Well, so I'll give you some information. The story of this game will be shitty.",
|
||||
["message9"] = "Especially the name. Sonic Radiance ? Is it a friggin Fire Emblem game ?",
|
||||
["messageType"] = "list",
|
||||
["title"] = "Shadow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="7" nextobjectid="20">
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="40" tilewidth="16" tileheight="16" infinite="0" nextlayerid="8" nextobjectid="21">
|
||||
<editorsettings>
|
||||
<export target="test2.lua" format="lua"/>
|
||||
</editorsettings>
|
||||
|
@ -110,13 +110,24 @@
|
|||
<object id="14" x="304" y="176" width="16" height="16"/>
|
||||
<object id="15" x="224" y="176" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
<objectgroup id="3" name="gizmo">
|
||||
<object id="16" x="176" y="64" width="16" height="16">
|
||||
<objectgroup id="3" name="gizmo"/>
|
||||
<objectgroup id="7" name="pnj">
|
||||
<object id="20" x="176" y="64" width="16" height="16">
|
||||
<properties>
|
||||
<property name="charDir" value="right"/>
|
||||
<property name="charId" type="int" value="5"/>
|
||||
<property name="charset" value="perso"/>
|
||||
<property name="isSolid" type="bool" value="true"/>
|
||||
<property name="message1" value="Sonic, you should stop doing stupid stuff and focus on defeating badnics."/>
|
||||
<property name="message2" value="What did I say ? Stop fooling around."/>
|
||||
<property name="message4" value="Seriously Sonic ?"/>
|
||||
<property name="message5" value="STOP. TALKING."/>
|
||||
<property name="message6" value="You'll do the whole list of message, don't you ?"/>
|
||||
<property name="message7" value="..."/>
|
||||
<property name="message8" value="Well, so I'll give you some information. The story of this game will be shitty."/>
|
||||
<property name="message9" value="Especially the name. Sonic Radiance ? Is it a friggin Fire Emblem game ?"/>
|
||||
<property name="messageType" value="list"/>
|
||||
<property name="title" value="Shadow"/>
|
||||
</properties>
|
||||
</object>
|
||||
</objectgroup>
|
||||
|
|
|
@ -69,10 +69,11 @@ end
|
|||
|
||||
function Gizmo:doAction()
|
||||
self:action()
|
||||
if (self.properties.destroy ~= "none") then
|
||||
if (self.properties.destroy == "forever") then
|
||||
game.destroyedGizmo[self.uniqueId] = true
|
||||
self:destroy()
|
||||
end
|
||||
if (self.properties.destroy == "temp") then
|
||||
self:destroy()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@ Obj.ItemBox = require(cwd .. "itembox")
|
|||
Obj.RingBox = require(cwd .. "ringbox")
|
||||
Obj.Encounter = require(cwd .. "encounter")
|
||||
Obj.Teleporter = require(cwd .. "teleport")
|
||||
Obj.PNJ = require(cwd .. "pnj")
|
||||
|
||||
Obj.index = {}
|
||||
Obj.index["player"] = Obj.Player
|
||||
|
@ -18,6 +19,7 @@ Obj.index["itembox"] = Obj.ItemBox
|
|||
Obj.index["ringbox"] = Obj.RingBox
|
||||
Obj.index["encounter"] = Obj.Encounter
|
||||
Obj.index["teleporter"] = Obj.Teleporter
|
||||
Obj.index["pnj"] = Obj.PNJ
|
||||
|
||||
Obj.collisions = {}
|
||||
Obj.collisions["wall"] = require(cwd .. "wall")
|
||||
|
|
50
sonic-radiance.love/scenes/overworld/actors/pnj.lua
Normal file
50
sonic-radiance.love/scenes/overworld/actors/pnj.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
local cwd = (...):gsub('%.pnj$', '') .. "."
|
||||
local Gizmo = require(cwd .. "gizmo")
|
||||
local PNJ = Gizmo:extend()
|
||||
|
||||
local overrides = {
|
||||
["isSolid"] = true,
|
||||
["destroy"] = "nope",
|
||||
["needButton"] = true,
|
||||
}
|
||||
|
||||
function PNJ:new(world, x, y)
|
||||
PNJ.super.new(self, world, x, y, 16, 16, overrides)
|
||||
end
|
||||
|
||||
function PNJ:applyProperties()
|
||||
PNJ.super.applyProperties(self)
|
||||
self.messages = {}
|
||||
for i = 1, 9, 1 do
|
||||
local message = self.properties["message" .. i]
|
||||
if (message ~= nil) then
|
||||
table.insert(self.messages, message)
|
||||
end
|
||||
end
|
||||
self.messageType = self.properties.messageType or "random"
|
||||
self.currentMessage = 1
|
||||
end
|
||||
|
||||
function PNJ:setMessage()
|
||||
local message = self.messages[1]
|
||||
if (self.messageType == "random") then
|
||||
message = self.messages[math.random(#self.messages)]
|
||||
elseif (self.messageType == "list") then
|
||||
message = self.messages[self.currentMessage]
|
||||
self.currentMessage = self.currentMessage + 1
|
||||
if (self.currentMessage > #self.messages) then
|
||||
self.currentMessage = 1
|
||||
end
|
||||
end
|
||||
self.event = {
|
||||
{"dialogBox", "", message, self.properties.title, ""},
|
||||
}
|
||||
end
|
||||
|
||||
function PNJ:action()
|
||||
self:setMessage()
|
||||
PNJ.super.action(self)
|
||||
end
|
||||
|
||||
|
||||
return PNJ
|
Loading…
Reference in a new issue