Malutki refactor

This commit is contained in:
2024-12-12 22:22:01 +01:00
parent f1dc19e795
commit 87399213b3

View File

@@ -1,10 +1,10 @@
#include "../headers/Kamikadze.h" #include "../headers/Kamikadze.h"
#include <iostream> #include <iostream>
#include "../headers/Bullet.h"
#include <random> #include <random>
#include "../headers/RandomNumberGenerator.h"
Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) { Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
actorSprite.setTexture(texture); actorSprite.setTexture(texture);
hp = 3; // 3 punkty życia hp = 3; // 3 punkty życia
@@ -14,11 +14,7 @@ Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, tex
void Kamikadze::shoot(){} void Kamikadze::shoot(){}
void Kamikadze::setRandomDirection() { void Kamikadze::setRandomDirection() {
std::random_device rd; int randomDirection = RandomNumberGenerator::getRandomNumber(0,3);
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dist(0, 3);
int randomDirection = dist(gen);
// Zapobieganie wyjscia poza ekran // Zapobieganie wyjscia poza ekran
switch (randomDirection) { switch (randomDirection) {