diff --git a/src/gui/main_ui.cpp b/src/gui/main_ui.cpp index b8cacf3..7f01ea2 100644 --- a/src/gui/main_ui.cpp +++ b/src/gui/main_ui.cpp @@ -20,6 +20,11 @@ namespace gui { $hand = textures::get_sprite(config["player"]["hands"]); $hand_anim = animation::load("assets/animation.json", config["player"]["hands"]); + + int width = $hand_anim.sheet.frame_width; + int height = $hand_anim.sheet.frame_height; + $hand.sprite->setPosition({float(RAY_VIEW_X + (RAY_VIEW_WIDTH - width) / 2), float(RAY_VIEW_HEIGHT - height)}); + } void MainUI::dirty() { @@ -152,7 +157,6 @@ namespace gui { if($hand_anim.playing) { $hand_anim.update(); $hand_anim.apply(*$hand.sprite); - $hand.sprite->setPosition({RAY_VIEW_X, RAY_VIEW_Y}); $window.draw(*$hand.sprite); } }