Super awesome twitchy animation for axe guy.

This commit is contained in:
Zed A. Shaw 2025-02-22 11:03:38 -05:00
parent 80a0f2ba75
commit 83df9ff03b
10 changed files with 42 additions and 68 deletions

View file

@ -147,16 +147,17 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
int tex_y = ((d * texture_height) / sprite_height) / texture_height;
sf::Vector2f scale{sprite_scale_w, sprite_scale_h};
sf::Vector2f position{x, y};
sf::IntRect in_texture{ {tex_x, tex_y}, {tex_render_width, texture_height}};
if($level.world->has<components::Animation>(rec.second)) {
auto& animation = $level.world->get<components::Animation>(rec.second);
animation.step(scale, in_texture);
if(animation.playing) animation.step(scale, in_texture);
}
sf_sprite->setScale(scale);
sf_sprite->setTextureRect(in_texture);
sf_sprite->setPosition({x, y});
sf_sprite->setPosition(position);
$brightness.setUniform("offsetFactor", sf::Glsl::Vec2{0.0f, 0.0f});
// the SpatialMap.distance_sorted only calculates the