Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/bubble.cpp b/bubble.cpp
index ef146eb..191f797 100644
--- a/bubble.cpp
+++ b/bubble.cpp
@@ -1,41 +1,39 @@
+#include <cmath>
#include "bubble.h"
Bubble::Bubble():
state(BubbleState::DICE),
timeCounter(0),
posY(0)
{
spritesBubbles = {{spriteDice, spriteFootSteps}};
if (!textureDice.loadFromFile("assets/img/bubble_dice.png"))
std::exit(1);
if (!textureFootSteps.loadFromFile("assets/img/bubble_footsteps.png"))
std::exit(1);
spritesBubbles[0].setTexture(textureDice);
spritesBubbles[1].setTexture(textureFootSteps);
-// sprites[0] = spriteDice;
-// sprites[1] = spriteFootSteps;
-//
}
void Bubble::setPosition(float x, float y) {
Transformable::setPosition(x, y);
posY = y;
}
void Bubble::draw(sf::RenderTarget& target, sf::RenderStates states) const {
states.transform *= getTransform();
target.draw(spritesBubbles[state], states);
}
void Bubble::update(sf::Time deltaTime)
{
timeCounter += deltaTime.asSeconds()*10;
float modifier = sin(timeCounter)*5;
Transformable::setPosition(getPosition().x, posY+modifier);
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 17, 9:17 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69794
Default Alt Text
(1 KB)

Event Timeline