Zaimplementowane menu i wybieranie skinów statku
This commit is contained in:
@@ -3,14 +3,24 @@
|
||||
#include "../headers/Plansza.h"
|
||||
#include "../headers/RandomNumberGenerator.h"
|
||||
|
||||
Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow)
|
||||
Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow, ships selectedShip)
|
||||
: background("../assets/img/background/background.png", 2.0f) {
|
||||
window = mainWindow;
|
||||
size.height = static_cast<int>(windowHeight);
|
||||
size.width = static_cast<int>(windowWidth);
|
||||
|
||||
Plansza::selectedShip = selectedShip;
|
||||
|
||||
try {
|
||||
playerTexture.loadFromFile("../assets/ship/Dreadnought-Base.png");
|
||||
if(selectedShip == nova) {
|
||||
playerTexture.loadFromFile("../assets/ship/nova.png");
|
||||
} else if(selectedShip == pulsar) {
|
||||
playerTexture.loadFromFile("../assets/ship/pulsar.png");
|
||||
} else if(selectedShip == zenith) {
|
||||
playerTexture.loadFromFile("../assets/ship/zenith.png");
|
||||
} else {
|
||||
playerTexture.loadFromFile("../assets/ship/Dreadnought-Base.png");
|
||||
}
|
||||
meteorTexture1.loadFromFile("../assets/img/meteors/meteor-1.png");
|
||||
meteorTexture2.loadFromFile("../assets/img/meteors/meteor-2.png");
|
||||
// Ładowanie tekstur wrogów
|
||||
@@ -803,4 +813,6 @@ void Plansza::update_score() {
|
||||
text.setFillColor(sf::Color::White);
|
||||
text.setPosition(25, 25);
|
||||
window->draw(text);
|
||||
}
|
||||
}
|
||||
|
||||
ships Plansza::selectedShip = none;
|
||||
@@ -7,8 +7,13 @@
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/Text.hpp>
|
||||
|
||||
#include "../headers/Plansza.h"
|
||||
|
||||
Player::Player(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
|
||||
hp = 3;
|
||||
if(Plansza::selectedShip != none) {
|
||||
actorSprite.setScale(0.20f, 0.20f);
|
||||
}
|
||||
}
|
||||
|
||||
Player* Player::getInstance(int x, int y, const sf::Texture& texture) {
|
||||
|
||||
Reference in New Issue
Block a user