Made a terrible animation sprite and then did a quick animation test. Won't keep it for now but this shows how it could work.
This commit is contained in:
parent
0882851b3f
commit
51858ea399
6 changed files with 9 additions and 4 deletions
|
@ -148,7 +148,9 @@ void Raycaster::sprite_casting() {
|
|||
int texY = ((d * textureHeight) / spriteHeight) / textureHeight;
|
||||
|
||||
sf_sprite->setScale({sprite_w, sprite_h});
|
||||
sf_sprite->setTextureRect(sf::IntRect({texX, texY}, {texX_end - texX, textureHeight}));
|
||||
auto time = $clock.getElapsedTime();
|
||||
int frame = int(time.asMicroseconds() / 200.0) % 4;
|
||||
sf_sprite->setTextureRect(sf::IntRect({texX + (textureWidth * frame), texY}, {texX_end - texX, textureHeight}));
|
||||
sf_sprite->setPosition({x, y});
|
||||
$window.draw(*sf_sprite);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue