mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-03 10:26:29 +00:00
animator fix
This commit is contained in:
@@ -31,11 +31,13 @@ namespace BBM
|
||||
const std::vector<std::vector<float>> moveDiag = {{-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}};
|
||||
const std::vector<float> rotationAngle = {0.0f, 45.0f, 90.0f, 135.0f, 180.0f, 225.0f, 270.0f, 315.0f};
|
||||
const auto &controllable = entity.getComponent<ControllableComponent>();
|
||||
auto &model = entity.getComponent<Drawable3DComponent<RAY3D::Model>>();
|
||||
auto drawable = entity.getComponent<Drawable3DComponent>().drawable.get();
|
||||
auto &animation = entity.getComponent<AnimationsComponent>();
|
||||
auto anim = dynamic_cast<RAY3D::Model *>(drawable);
|
||||
for (int i = 0; i != moveDiag.size(); i++) {
|
||||
if (controllable.move.x == moveDiag[i][0] && controllable.move.y == moveDiag[i][1]) {
|
||||
model.member.setRotationAngle(rotationAngle[i]);
|
||||
if (anim)
|
||||
anim->setRotationAngle(rotationAngle[i]);
|
||||
animation.setAnimIndex(0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user