parent
93254fefa1
commit
70029ba7bd
5 changed files with 181 additions and 11 deletions
|
@ -8,8 +8,8 @@ return {
|
||||||
height = 40,
|
height = 40,
|
||||||
tilewidth = 16,
|
tilewidth = 16,
|
||||||
tileheight = 16,
|
tileheight = 16,
|
||||||
nextlayerid = 7,
|
nextlayerid = 8,
|
||||||
nextobjectid = 19,
|
nextobjectid = 21,
|
||||||
properties = {},
|
properties = {},
|
||||||
tilesets = {
|
tilesets = {
|
||||||
{
|
{
|
||||||
|
@ -316,6 +316,42 @@ return {
|
||||||
id = 102,
|
id = 102,
|
||||||
type = "solid"
|
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,
|
id = 129,
|
||||||
type = "solid"
|
type = "solid"
|
||||||
|
@ -323,6 +359,54 @@ return {
|
||||||
{
|
{
|
||||||
id = 130,
|
id = 130,
|
||||||
type = "solid"
|
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,
|
offsetx = 0,
|
||||||
offsety = 0,
|
offsety = 0,
|
||||||
properties = {},
|
properties = {},
|
||||||
|
objects = {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "objectgroup",
|
||||||
|
draworder = "topdown",
|
||||||
|
id = 7,
|
||||||
|
name = "pnj",
|
||||||
|
visible = true,
|
||||||
|
opacity = 1,
|
||||||
|
offsetx = 0,
|
||||||
|
offsety = 0,
|
||||||
|
properties = {},
|
||||||
objects = {
|
objects = {
|
||||||
{
|
{
|
||||||
id = 16,
|
id = 20,
|
||||||
name = "",
|
name = "",
|
||||||
type = "",
|
type = "",
|
||||||
shape = "rectangle",
|
shape = "rectangle",
|
||||||
|
@ -676,7 +772,17 @@ return {
|
||||||
["charDir"] = "right",
|
["charDir"] = "right",
|
||||||
["charId"] = 5,
|
["charId"] = 5,
|
||||||
["charset"] = "perso",
|
["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"?>
|
<?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>
|
<editorsettings>
|
||||||
<export target="test2.lua" format="lua"/>
|
<export target="test2.lua" format="lua"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
@ -110,13 +110,24 @@
|
||||||
<object id="14" x="304" y="176" width="16" height="16"/>
|
<object id="14" x="304" y="176" width="16" height="16"/>
|
||||||
<object id="15" x="224" y="176" width="16" height="16"/>
|
<object id="15" x="224" y="176" width="16" height="16"/>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="3" name="gizmo">
|
<objectgroup id="3" name="gizmo"/>
|
||||||
<object id="16" x="176" y="64" width="16" height="16">
|
<objectgroup id="7" name="pnj">
|
||||||
|
<object id="20" x="176" y="64" width="16" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="charDir" value="right"/>
|
<property name="charDir" value="right"/>
|
||||||
<property name="charId" type="int" value="5"/>
|
<property name="charId" type="int" value="5"/>
|
||||||
<property name="charset" value="perso"/>
|
<property name="charset" value="perso"/>
|
||||||
<property name="isSolid" type="bool" value="true"/>
|
<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>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|
|
@ -69,10 +69,11 @@ end
|
||||||
|
|
||||||
function Gizmo:doAction()
|
function Gizmo:doAction()
|
||||||
self:action()
|
self:action()
|
||||||
if (self.properties.destroy ~= "none") then
|
|
||||||
if (self.properties.destroy == "forever") then
|
if (self.properties.destroy == "forever") then
|
||||||
game.destroyedGizmo[self.uniqueId] = true
|
game.destroyedGizmo[self.uniqueId] = true
|
||||||
|
self:destroy()
|
||||||
end
|
end
|
||||||
|
if (self.properties.destroy == "temp") then
|
||||||
self:destroy()
|
self:destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ Obj.ItemBox = require(cwd .. "itembox")
|
||||||
Obj.RingBox = require(cwd .. "ringbox")
|
Obj.RingBox = require(cwd .. "ringbox")
|
||||||
Obj.Encounter = require(cwd .. "encounter")
|
Obj.Encounter = require(cwd .. "encounter")
|
||||||
Obj.Teleporter = require(cwd .. "teleport")
|
Obj.Teleporter = require(cwd .. "teleport")
|
||||||
|
Obj.PNJ = require(cwd .. "pnj")
|
||||||
|
|
||||||
Obj.index = {}
|
Obj.index = {}
|
||||||
Obj.index["player"] = Obj.Player
|
Obj.index["player"] = Obj.Player
|
||||||
|
@ -18,6 +19,7 @@ Obj.index["itembox"] = Obj.ItemBox
|
||||||
Obj.index["ringbox"] = Obj.RingBox
|
Obj.index["ringbox"] = Obj.RingBox
|
||||||
Obj.index["encounter"] = Obj.Encounter
|
Obj.index["encounter"] = Obj.Encounter
|
||||||
Obj.index["teleporter"] = Obj.Teleporter
|
Obj.index["teleporter"] = Obj.Teleporter
|
||||||
|
Obj.index["pnj"] = Obj.PNJ
|
||||||
|
|
||||||
Obj.collisions = {}
|
Obj.collisions = {}
|
||||||
Obj.collisions["wall"] = require(cwd .. "wall")
|
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