Mostly working torch sprites have taught me what I need for the animation system.
This commit is contained in:
parent
a578c49a77
commit
59ba73baa0
5 changed files with 35 additions and 2 deletions
|
|
@ -141,5 +141,16 @@
|
||||||
"frames": 2,
|
"frames": 2,
|
||||||
"speed": 0.02,
|
"speed": 0.02,
|
||||||
"stationary": true
|
"stationary": true
|
||||||
|
},
|
||||||
|
"torch_crappy": {
|
||||||
|
"_type": "Animation",
|
||||||
|
"easing": 0,
|
||||||
|
"ease_rate": 0.5,
|
||||||
|
"scale": 0.4,
|
||||||
|
"max_scale": 0.4,
|
||||||
|
"simple": true,
|
||||||
|
"frames": 1,
|
||||||
|
"speed": 0.02,
|
||||||
|
"stationary": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
boss/ui.cpp
14
boss/ui.cpp
|
|
@ -27,6 +27,12 @@ namespace boss {
|
||||||
|
|
||||||
dbc::check(animation::has(sprite.name), "add boss animation to animations.json");
|
dbc::check(animation::has(sprite.name), "add boss animation to animations.json");
|
||||||
$boss_anim = animation::load(sprite.name);
|
$boss_anim = animation::load(sprite.name);
|
||||||
|
|
||||||
|
$torch_left = textures::get_sprite("torch_crappy");
|
||||||
|
$torch_left_anim = animation::load("torch_crappy");
|
||||||
|
$torch_right.texture = $torch_left.texture;
|
||||||
|
$torch_right.sprite = std::make_shared<sf::Sprite>(*$torch_right.texture);
|
||||||
|
$torch_right_anim = animation::load("torch_crappy");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::init() {
|
void UI::init() {
|
||||||
|
|
@ -37,7 +43,7 @@ namespace boss {
|
||||||
|
|
||||||
$arena.layout(
|
$arena.layout(
|
||||||
"[status|boss1 |boss2 |boss3 |boss4 |_]"
|
"[status|boss1 |boss2 |boss3 |boss4 |_]"
|
||||||
"[_ |boss5 |boss6 |boss7 |boss8 |_]"
|
"[torch1|boss5 |boss6 |boss7 |boss8 |torch2]"
|
||||||
"[floor1|boss9 |boss10|boss11|boss12|_]"
|
"[floor1|boss9 |boss10|boss11|boss12|_]"
|
||||||
"[floor2|boss13|boss14|boss15|boss16|_]"
|
"[floor2|boss13|boss14|boss15|boss16|_]"
|
||||||
"[floor3|player1|player2|player3|player4|_]"
|
"[floor3|player1|player2|player3|player4|_]"
|
||||||
|
|
@ -51,6 +57,9 @@ namespace boss {
|
||||||
position_sprite($floor_sprite, $scene.floor_pos, 1.0, false);
|
position_sprite($floor_sprite, $scene.floor_pos, 1.0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
position_sprite($torch_left, "torch1", 1.0, false);
|
||||||
|
position_sprite($torch_right, "torch2", 1.0, false);
|
||||||
|
|
||||||
$arena.init();
|
$arena.init();
|
||||||
|
|
||||||
$actions.position(0,0, SCREEN_WIDTH-BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
|
$actions.position(0,0, SCREEN_WIDTH-BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
@ -94,6 +103,9 @@ namespace boss {
|
||||||
window.draw(*$boss_sprite.sprite);
|
window.draw(*$boss_sprite.sprite);
|
||||||
window.draw(*$player_sprite.sprite);
|
window.draw(*$player_sprite.sprite);
|
||||||
|
|
||||||
|
window.draw(*$torch_left.sprite);
|
||||||
|
window.draw(*$torch_right.sprite);
|
||||||
|
|
||||||
// $arena.debug_layout(window);
|
// $arena.debug_layout(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ namespace boss {
|
||||||
components::Animation $boss_anim;
|
components::Animation $boss_anim;
|
||||||
sf::Vector2f $boss_pos;
|
sf::Vector2f $boss_pos;
|
||||||
|
|
||||||
|
SpriteTexture $torch_left;
|
||||||
|
SpriteTexture $torch_right;
|
||||||
|
components::Animation $torch_left_anim;
|
||||||
|
components::Animation $torch_right_anim;
|
||||||
|
|
||||||
UI(shared_ptr<World> world, Entity boss_id);
|
UI(shared_ptr<World> world, Entity boss_id);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ namespace gui {
|
||||||
$font{FONT_FILE_NAME},
|
$font{FONT_FILE_NAME},
|
||||||
$dnd_loot($status_ui, $loot_ui, $window, $router)
|
$dnd_loot($status_ui, $loot_ui, $window, $router)
|
||||||
{
|
{
|
||||||
|
$window.setVerticalSyncEnabled(VSYNC);
|
||||||
|
if(FRAME_LIMIT) $window.setFramerateLimit(FRAME_LIMIT);
|
||||||
$window.setPosition({0,0});
|
$window.setPosition({0,0});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ int main(int, char*[]) {
|
||||||
GameDB::init();
|
GameDB::init();
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Bossfight Testing Arena");
|
sf::RenderWindow window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Bossfight Testing Arena");
|
||||||
|
window.setVerticalSyncEnabled(VSYNC);
|
||||||
|
if(FRAME_LIMIT) window.setFramerateLimit(FRAME_LIMIT);
|
||||||
|
window.setPosition({0,0});
|
||||||
|
|
||||||
gui::routing::Router router;
|
gui::routing::Router router;
|
||||||
|
|
||||||
sound::mute(true);
|
sound::mute(true);
|
||||||
|
|
@ -41,7 +45,6 @@ int main(int, char*[]) {
|
||||||
auto main = boss::System::create_bossfight();
|
auto main = boss::System::create_bossfight();
|
||||||
auto world = GameDB::current_world();
|
auto world = GameDB::current_world();
|
||||||
|
|
||||||
|
|
||||||
while(!main->in_state(boss::State::END)) {
|
while(!main->in_state(boss::State::END)) {
|
||||||
main->mouse_pos = window.mapPixelToCoords(router.position);
|
main->mouse_pos = window.mapPixelToCoords(router.position);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue