1
Graphics / Re: How to move a sprite in a fixed range?
« on: January 06, 2020, 01:30:07 am »
Thanks I'll try!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
int main(){
while (window.isOpen()) {
sprite.move(0.f, 0.0001f * elapsed.asMicroseconds());
clock.restart();
if (sprite.getPosition().y >= 352) {
do {
sprite.move(0.f, -0.0001f * elapsed.asMicroseconds());
clock.restart();
} while (sprite.getPosition().y >= 0);
}
window.draw(sprite);
window.display();
}
}