diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-12 00:45:43 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-12 00:45:43 -0500 |
| commit | 0a3ec1862fd479295639a38ab4799e4d36e12c13 (patch) | |
| tree | 8651ccafcae9d53fb63234e089158a7cb29c278c /src/map.cpp | |
| parent | 5ecd0f428dd8292a17c5013c525a4f5d3967acb8 (diff) | |
| download | tanetane-0a3ec1862fd479295639a38ab4799e4d36e12c13.tar.gz tanetane-0a3ec1862fd479295639a38ab4799e4d36e12c13.tar.bz2 tanetane-0a3ec1862fd479295639a38ab4799e4d36e12c13.zip | |
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).
Diffstat (limited to 'src/map.cpp')
| -rw-r--r-- | src/map.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
| 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) { | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | triggers_.push_back(std::move(t)); | 101 | triggers_.push_back(std::move(t)); |
| 102 | } else if (object.getType() == "tileSprite") { | ||
| 103 | Prototype p; | ||
| 104 | p.name = object.getName(); | ||
| 105 | p.pos.x() = std::floor(object.getPosition().x / 16) * 16; | ||
| 106 | p.pos.y() = std::floor(object.getPosition().y / 16) * 16; | ||
| 107 | p.collisionOffset = { 0, 0 }; | ||
| 108 | p.collisionSize = { 16, 16 }; | ||
| 109 | |||
| 110 | for (const tmx::Property& property : object.getProperties()) { | ||
| 111 | if (property.getName() == "interactionScript") { | ||
| 112 | p.interactionScript = property.getStringValue(); | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | prototypes_.push_back(std::move(p)); | ||
| 102 | } | 117 | } |
| 103 | } | 118 | } |
| 104 | } | 119 | } |
