diff --git a/sonic-radiance.love/datas/gamedata/maps/area/test/grotto.lua b/sonic-radiance.love/datas/gamedata/maps/area/test/grotto.lua new file mode 100644 index 0000000..f2f8b6d --- /dev/null +++ b/sonic-radiance.love/datas/gamedata/maps/area/test/grotto.lua @@ -0,0 +1,15 @@ +return { + areaName = "testmap2", + canSave = true, + color = {0.3, 0.3, 0.3}, + maps = { + { + name = "Not Hidden Grotto", + music = "testmap", + folder = "test", + map = "map", + x = 0, + y = 0, + } + } +} \ No newline at end of file diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.lua b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.lua index 75eaaa8..f2242b4 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.lua +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.lua @@ -302,6 +302,98 @@ 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" + }, + { + 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" } } } diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.png b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.png index 55ad23a..495abe2 100644 Binary files a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.png and b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.png differ diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.tsx b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.tsx index 736f5f5..bb05e32 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.tsx +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/plain1.tsx @@ -71,6 +71,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua index b311a6b..4225f40 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.lua @@ -8,8 +8,8 @@ return { height = 40, tilewidth = 16, tileheight = 16, - nextlayerid = 10, - nextobjectid = 25, + nextlayerid = 11, + nextobjectid = 26, 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" } } } @@ -404,9 +488,9 @@ return { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 58, 58, 58, 58, 58, 58, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 66, 66, 66, 66, 66, 66, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 0, 0, 0, 0, 0, 0, 0, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 0, 0, 0, 0, 0, 0, 0, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 0, 0, 0, 0, 0, 0, 0, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 109, 110, 111, 50, 50, 50, 50, 50, 50, 50, + 0, 0, 0, 0, 0, 0, 0, 57, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 117, 118, 119, 58, 58, 58, 58, 58, 58, 58, + 0, 0, 0, 0, 0, 0, 0, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 125, 126, 127, 66, 66, 66, 66, 66, 66, 66, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -442,6 +526,38 @@ return { 39, 0, 0, 0, 0, 39, 0, 0, 0, 0, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39 } }, + { + type = "objectgroup", + draworder = "topdown", + id = 10, + name = "teleporter", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + properties = {}, + objects = { + { + id = 25, + name = "", + type = "", + shape = "rectangle", + x = 336, + y = 96, + width = 16, + height = 16, + rotation = 0, + visible = true, + properties = { + ["area"] = "test.grotto", + ["isSolid"] = true, + ["needButton"] = true, + ["x"] = 12, + ["y"] = 12 + } + } + } + }, { type = "objectgroup", draworder = "topdown", diff --git a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx index f5decfd..c9a5ef6 100644 --- a/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx +++ b/sonic-radiance.love/datas/gamedata/maps/sti/plain/test.tmx @@ -1,5 +1,5 @@ - + @@ -54,9 +54,9 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 58,58,58,58,58,58,58,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 66,66,66,66,66,66,66,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50, -0,0,0,0,0,0,0,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58, -0,0,0,0,0,0,0,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66, +0,0,0,0,0,0,0,49,50,50,50,50,50,50,50,50,50,50,50,50,109,110,111,50,50,50,50,50,50,50, +0,0,0,0,0,0,0,57,58,58,58,58,58,58,58,58,58,58,58,58,117,118,119,58,58,58,58,58,58,58, +0,0,0,0,0,0,0,65,66,66,66,66,66,66,66,66,66,66,66,66,125,126,127,66,66,66,66,66,66,66, 39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,130,131,132, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -92,6 +92,17 @@ 39,0,0,0,0,39,0,0,0,0,23,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39 + + + + + + + + + + + diff --git a/sonic-radiance.love/game/events/arguments.lua b/sonic-radiance.love/game/events/arguments.lua index f5c7601..ae9f3ab 100644 --- a/sonic-radiance.love/game/events/arguments.lua +++ b/sonic-radiance.love/game/events/arguments.lua @@ -5,7 +5,8 @@ return { ["optionBox"] = {"message", "title", "avatar", "option1", "option2", "option3", "flag"}, ["playSFX"] = {"sfx"}, ["getRings"] = {"number"}, - ["getItems"] = {"type", "item", "number"} + ["getItems"] = {"type", "item", "number"}, + ["teleport"] = {"area", "x", "y"} --[name] = {args...}, } diff --git a/sonic-radiance.love/game/events/event/init.lua b/sonic-radiance.love/game/events/event/init.lua index e6b948a..2c10671 100644 --- a/sonic-radiance.love/game/events/event/init.lua +++ b/sonic-radiance.love/game/events/event/init.lua @@ -5,5 +5,6 @@ return { ["optionBox"] = require("game.events.event.dialogbox"), ["playSFX"] = require("game.events.event.playSFX"), ["getRings"] = require("game.events.event.getRings"), - ["getItems"] = require("game.events.event.getItems") + ["getItems"] = require("game.events.event.getItems"), + ["teleport"] = require("game.events.event.teleport") } \ No newline at end of file diff --git a/sonic-radiance.love/game/events/event/teleport.lua b/sonic-radiance.love/game/events/event/teleport.lua new file mode 100644 index 0000000..bca3bb4 --- /dev/null +++ b/sonic-radiance.love/game/events/event/teleport.lua @@ -0,0 +1,19 @@ +local StepParent = require "game.events.event.parent" +local SimpleMessageStep = StepParent:extend() +local defTransitions = require "core.modules.transitions" + +function SimpleMessageStep:new(controller, args) + SimpleMessageStep.super.new(self, controller, args) +end + +function SimpleMessageStep:start() + core.screen:startTransition(defTransitions.default, defTransitions.default, + function() self.events.scene.world:teleport(self.arguments.area, self.arguments.x, self.arguments.y) end, + 0, 0) +end + +function SimpleMessageStep:update(dt) + self:finish() +end + +return SimpleMessageStep; diff --git a/sonic-radiance.love/scenes/overworld/actors/init.lua b/sonic-radiance.love/scenes/overworld/actors/init.lua index 723206d..35ea3d6 100644 --- a/sonic-radiance.love/scenes/overworld/actors/init.lua +++ b/sonic-radiance.love/scenes/overworld/actors/init.lua @@ -8,6 +8,7 @@ Obj.Ring = require(cwd .. "ring") Obj.ItemBox = require(cwd .. "itembox") Obj.RingBox = require(cwd .. "ringbox") Obj.Encounter = require(cwd .. "encounter") +Obj.Teleporter = require(cwd .. "teleport") Obj.index = {} Obj.index["player"] = Obj.Player @@ -16,6 +17,7 @@ Obj.index["ring"] = Obj.Ring Obj.index["itembox"] = Obj.ItemBox Obj.index["ringbox"] = Obj.RingBox Obj.index["encounter"] = Obj.Encounter +Obj.index["teleporter"] = Obj.Teleporter Obj.collisions = {} Obj.collisions["wall"] = require(cwd .. "wall") diff --git a/sonic-radiance.love/scenes/overworld/actors/teleport.lua b/sonic-radiance.love/scenes/overworld/actors/teleport.lua new file mode 100644 index 0000000..390e9cf --- /dev/null +++ b/sonic-radiance.love/scenes/overworld/actors/teleport.lua @@ -0,0 +1,16 @@ +local cwd = (...):gsub('%.teleport$', '') .. "." +local Gizmo = require(cwd .. "gizmo") +local Teleporter = Gizmo:extend() + +function Teleporter:new(world, x, y, w, h) + Teleporter.super.new(self, world, x, y, w, h, nil) +end + +function Teleporter:applyProperties() + Teleporter.super.applyProperties(self) + self.event = { + {"teleport", "", self.properties.area, self.properties.x, self.properties.y}, + } +end + +return Teleporter \ No newline at end of file diff --git a/sonic-radiance.love/scenes/overworld/world.lua b/sonic-radiance.love/scenes/overworld/world.lua index bec1dc4..ed51a40 100644 --- a/sonic-radiance.love/scenes/overworld/world.lua +++ b/sonic-radiance.love/scenes/overworld/world.lua @@ -21,6 +21,15 @@ function RPGWorld:savePosition() game.position.area = self.area end +function RPGWorld:teleport(area, x, y) + if (area == self.area) then + self.players[1].actor.x = x * 16 + self.players[1].actor.y = y * 16 + else + scenes.overworld(area, x, y) + end +end + function RPGWorld:restoreActions() self.encounter:destroy() local currentMap = self.map:getMapAtPoint(self.players[1].actor.x, self.players[1].actor.y)