summary refs log tree commit diff stats
path: root/src/map.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-23 22:22:49 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-02-24 16:00:53 -0500
commitb06b259c54e09f1a4026191d6eec9684599bd370 (patch)
treef31b241c3da5559d388d97bf9e65c2104f4652e8 /src/map.cpp
parentae654356f843bb42a3c72d57b528d87aa63cf66d (diff)
downloadtanetane-b06b259c54e09f1a4026191d6eec9684599bd370.tar.gz
tanetane-b06b259c54e09f1a4026191d6eec9684599bd370.tar.bz2
tanetane-b06b259c54e09f1a4026191d6eec9684599bd370.zip
Started working on ladders
TODO:
* all the animations are weird. we will need to have an adjustable framerate bc the climbing animation does not look right at the current rate. (also remove the manual animation stuff ig)
* does the medium stuff seem good and right? i am kinda not satisfied with it.
* running onto a ladder causes the characters to bunch up bc the movement speed is slowed down but the trails are not doubled
* no ladder running sound
* shadows should vanish while on a ladder
* uhh if you end a cutscene while on a ladder it resets the animation to "still" which is wrong. will this ever happen? idk
* adding a sprite to your party while you are on a ladder??
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp index 4781231..0425962 100644 --- a/src/map.cpp +++ b/src/map.cpp
@@ -44,6 +44,10 @@ Map::Map(std::string_view name) : name_(name) {
44 tile.blocked = true; 44 tile.blocked = true;
45 } else if (property.getName() == "runSound") { 45 } else if (property.getName() == "runSound") {
46 tile.step = stepTypeFromString(property.getStringValue()); 46 tile.step = stepTypeFromString(property.getStringValue());
47 } else if (property.getName() == "medium") {
48 if (property.getStringValue() == "ladder") {
49 tile.medium = CharacterMedium::Ladder;
50 }
47 } 51 }
48 } 52 }
49 53
@@ -178,3 +182,21 @@ StepType Map::getStepType(int x, int y) const {
178 182
179 return StepType::none; 183 return StepType::none;
180} 184}
185
186CharacterMedium Map::getMedium(int x, int y) const {
187 CharacterMedium ret = CharacterMedium::Normal;
188
189 if (x < 0 || y < 0 || x >= mapSize_.w() || y >= mapSize_.h()) {
190 return ret;
191 }
192
193 int i = x + y * mapSize_.w();
194
195 for (const std::vector<Tile>& layer : lowerLayers_) {
196 if (layer.at(i).medium > ret) {
197 ret = layer.at(i).medium;
198 }
199 }
200
201 return ret;
202}