From 0a3ec1862fd479295639a38ab4799e4d36e12c13 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 12 Feb 2021 00:45:43 -0500 Subject: Added tile-sized invisible sprites These are used when you want a solid, interactable object that is part of the map instead of sprite animated (e.g. the mailboxes). --- src/map.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 8d4aa2d..da382fd 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -99,6 +99,21 @@ Map::Map(std::string_view name) : name_(name) { } triggers_.push_back(std::move(t)); + } else if (object.getType() == "tileSprite") { + Prototype p; + p.name = object.getName(); + p.pos.x() = std::floor(object.getPosition().x / 16) * 16; + p.pos.y() = std::floor(object.getPosition().y / 16) * 16; + p.collisionOffset = { 0, 0 }; + p.collisionSize = { 16, 16 }; + + for (const tmx::Property& property : object.getProperties()) { + if (property.getName() == "interactionScript") { + p.interactionScript = property.getStringValue(); + } + } + + prototypes_.push_back(std::move(p)); } } } -- cgit 1.4.1