#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <math.h>
#include <random>
#include <iterator>
using namespace std;
Particle::Particle(string soundEffect) {
sprite = sf::CircleShape(5.f);
//positionIterator = 0;
positions = {};
movements = {};
animationPreviousTime = 0;
durationPreviousTime = 0;
currentTime = 0;
animationDelay = 0.01;
buffer.loadFromFile(soundEffect);
sound.setBuffer(buffer);
}
void Particle::activate(int startX, int startY, sf::Color color, int amount, float newDuration) {
if (positions.size() < 100) {
sprite.setFillColor(color);
duration = newDuration;
sound.setBuffer(buffer);
sound.play();
createPositions(startX, startY, amount);
durationPreviousTime = gameClock.getElapsedTime().asSeconds();
}
}