Skip to content

Commit

Permalink
feat(Assets): Added walk animation to all units and flip
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreksu authored and kyranet committed Apr 21, 2019
1 parent db9ce56 commit 8379b09
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Drakhtar/Controllers/PlayerController.cpp
Expand Up @@ -52,11 +52,13 @@ void PlayerController::onClickMove(Box* boxClicked) {
->setRoute(board_->pathToRoute(path))
->setDuration(static_cast<int>(
floor(static_cast<double>(path.size()) * GAME_FRAMERATE * 0.25)))
->setOnStart([unit]() { unit->getTexture()->setAnimation("walk"); })
->setOnUpdate([unit](Vector2D<double> updated) {
unit->setPosition({static_cast<int>(std::floor(updated.getX())),
static_cast<int>(std::floor(updated.getY()))});
})
->setOnComplete([this, unit, boxClicked]() {
unit->getTexture()->setAnimation("default");
hasMoved_ = true;
locked_ = false;
// If there are enemies in range, highlight them, otherwise skip turn
Expand Down
64 changes: 42 additions & 22 deletions Drakhtar/Structures/Game.cpp
Expand Up @@ -52,62 +52,82 @@ void Game::load() {
textures->add("Units-BlueArcher", "../images/Units/BlueArcher.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->setFlip(SDL_FLIP_HORIZONTAL);
->addAnimation("walk", {11, 12});
textures->add("Units-BlueKnight", "../images/Units/BlueKnight.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})
->setFlip(SDL_FLIP_HORIZONTAL)
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("walk", {11, 12})
->setScale({1.5, 1.5});
textures->add("Units-BlueMage", "../images/Units/BlueMage.png", 3, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8});
->addAnimation("attack", {2, 3, 4, 5, 6})
->addAnimation("walk", {7, 8});
textures->add("Units-BlueMonster", "../images/Units/BlueMonster.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8})
->addAnimation("walk", {9, 10});
textures->add("Units-BlueSoldier", "../images/Units/BlueSoldier.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11})
->setFlip(SDL_FLIP_HORIZONTAL);
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8})
->addAnimation("walk", {9, 10});
textures->add("Units-Thassa", "../images/Units/Thassa.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10});
textures->add("Units-BlueValar", "../images/Units/BlueValar.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->setFlip(SDL_FLIP_HORIZONTAL);
->addAnimation("walk", {11, 12});
textures->add("Units-Abeizhul", "../images/Units/Abeizhul.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9})
->addAnimation("walk", {10, 11})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-Dreilay", "../images/Units/Dreilay.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("walk", {11, 12})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedArcher", "../images/Units/RedArcher.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("walk", {11, 12})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedKnight", "../images/Units/RedKnight.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})
->setScale({1.5, 1.5});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("walk", {11, 12})
->setScale({1.5, 1.5})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedMage", "../images/Units/RedMage.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8})
->addAnimation("walk", {9, 10})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedMonster", "../images/Units/RedMonster.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8})
->addAnimation("walk", {9, 10})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedSoldier", "../images/Units/RedSoldier.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9})
->addAnimation("walk", {10, 11})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-Sheissa", "../images/Units/Sheissa.png", 4, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10});
textures->add("Units-BlueValar", "../images/Units/BlueValar.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8})
->addAnimation("walk", {9, 10})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-RedValar", "../images/Units/RedValar.png", 5, 3)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10})
->addAnimation("walk", {11, 12})
->setFlip(SDL_FLIP_HORIZONTAL);
textures->add("Units-Zamdran", "../images/Units/Zamdran.png", 4, 4)
->addAnimation("default", {0, 1})
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14});
->addAnimation("attack", {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})
->addAnimation("walk", {13, 14})
->setFlip(SDL_FLIP_HORIZONTAL);

// UI
textures->add("UI-cellFrame", "../images/UI/cellFrame.png", 1, 1);
Expand Down
Binary file modified images/Units/Abeizhul.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/BlueArcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/BlueKnight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/BlueSoldier.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/BlueValar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/Dreilay.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/RedArcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/RedKnight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/RedSoldier.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/RedValar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/Sheissa.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/Thassa.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Units/Zamdran.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8379b09

Please sign in to comment.