Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F134122
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
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
Details
Attached
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)
Attached To
Mode
R82 deerportal
Attached
Detach File
Event Timeline