#include "GameRenderer.hpp" #include "Player.hpp" Player::Player(GameRenderer *renderer) : renderer(renderer) { hero_sprite = renderer->load_sprite("./assets/hero_front.png", 40, 40); bow_sprite = renderer->load_sprite("./assets/bow_arrow.png", 22, 32); } void Player::draw() const { renderer->draw_sprite( hero_sprite, renderer->screen_width / 2 - hero_sprite.width / 2, renderer->screen_height / 2 - hero_sprite.height / 2 ); renderer->draw_sprite_rotated( bow_sprite, renderer->screen_width / 2 - bow_sprite.width / 2 + std::cos(angle) * 30, renderer->screen_height / 2 - bow_sprite.height / 2 + std::sin(angle) * 30, angle * 180 / M_PI ); } void Player::update() { x += x_vel; y += y_vel; }