Dziuala 3 strzlowiec

This commit is contained in:
2024-12-10 20:20:05 +01:00
parent 77eb83c2c3
commit 81b04bae0f
12 changed files with 279 additions and 15 deletions

View File

@@ -2,8 +2,8 @@
#include <iostream>
Actor::Actor(int x, int y, std::string path) {
loadTexture(path);
Actor::Actor(int x, int y, const sf::Texture& texture) {
actorSprite.setTexture(texture);
position.x = x;
position.y = y;
actorSprite.setOrigin(actorSprite.getLocalBounds().width / 2, actorSprite.getLocalBounds().height / 2); // wycentrowanie sprite
@@ -19,6 +19,9 @@ void Actor::loadTexture(std::string path) {
}
sf::Sprite &Actor::getSprite() {
if (!actorSprite.getTexture()) {
std::cerr << "actorSprite has no texture set!" << std::endl;
}
return actorSprite;
}