Closer to what I want for sprite loading but still needs more work.

This commit is contained in:
Zed A. Shaw 2025-01-25 12:19:14 -05:00
parent 51858ea399
commit 6ed57cd4a8
4 changed files with 23 additions and 17 deletions

View file

@ -148,9 +148,7 @@ void Raycaster::sprite_casting() {
int texY = ((d * textureHeight) / spriteHeight) / textureHeight;
sf_sprite->setScale({sprite_w, sprite_h});
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->setTextureRect(sf::IntRect({texX, texY}, {texX_end - texX, textureHeight}));
sf_sprite->setPosition({x, y});
$window.draw(*sf_sprite);
}