diff options
author | Andy <drumsetmonkey@gmail.com> | 2017-01-06 08:46:14 -0500 |
---|---|---|
committer | Andy <drumsetmonkey@gmail.com> | 2017-01-06 08:46:14 -0500 |
commit | cf0deda5f30eb3bf6b4ea6a1d47aa7dad115b799 (patch) | |
tree | e06e6994221ac1e3ca5c81706b5888684dfd50ca /src/world.cpp | |
parent | d7d1b397197893f0ce49b28f762711b7a9ef1087 (diff) |
Sprite sheets and flipping
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/world.cpp b/src/world.cpp index 6b18542..a26a4fa 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -338,9 +338,9 @@ void WorldSystem::load(const std::string& file) if (abcd->Attribute("value") != nullptr) dim = str2coord(abcd->StrAttribute("value")); else - dim = entity.component<Sprite>().get()->getSpriteSize() * game::HLINE; + dim = entity.component<Sprite>()->getSpriteSize(); - float cdat[2] = {dim.x, dim.y}; + float cdat[2] = {dim.x * game::HLINE, dim.y * game::HLINE}; entity.assign<Solid>(cdat[0], cdat[1]); } else if (tname == "Direction") { vec2 dir; @@ -382,13 +382,17 @@ void WorldSystem::load(const std::string& file) while (animx) { std::string animType = animx->Name(); if (animType == "movement") { - auto frames = developFrame(animx); - if (animx->UnsignedAttribute("changeID") != XML_NO_ERROR) - idtc = 0; - else - idtc = animx->UnsignedAttribute("changeID"); - for (uint i = 0; i < frames.size(); i++) { - entan->frame.push_back(std::make_pair(idtc, frames[i])); + auto limbx = animx->FirstChildElement(); + while (limbx) { + auto frames = developFrame(limbx); + if (limbx->UnsignedAttribute("changeID") != XML_NO_ERROR) + idtc = 0; + else + idtc = limbx->UnsignedAttribute("changeID"); + for (uint i = 0; i < frames.size(); i++) { + entan->frame.push_back(std::make_pair(idtc, frames[i])); + } + limbx = limbx->NextSiblingElement(); } } |