Animations can work on Sprites,Transformables, and Views and the arena shows the hit/miss text so it follows the entity and hides when the animation stops.
This commit is contained in:
parent
0d23cf9537
commit
f175a5d4aa
3 changed files with 53 additions and 32 deletions
|
|
@ -89,12 +89,11 @@ namespace scene {
|
|||
|
||||
for(auto& fixture : $fixtures) {
|
||||
window.draw(*fixture.st.sprite);
|
||||
window.draw(fixture.text);
|
||||
}
|
||||
|
||||
for(auto& actor : $actors) {
|
||||
window.draw(*actor.st.sprite);
|
||||
window.draw(actor.text);
|
||||
if(actor.anim.playing) window.draw(actor.text);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -120,22 +119,18 @@ namespace scene {
|
|||
for(auto& fixture : $fixtures) {
|
||||
if(fixture.anim.playing) {
|
||||
fixture.anim.apply(*fixture.st.sprite, fixture.pos);
|
||||
fixture.text.setPosition(fixture.pos);
|
||||
fixture.text.setScale({fixture.scale_x, fixture.scale_y});
|
||||
}
|
||||
}
|
||||
|
||||
for(auto& actor : $actors) {
|
||||
if(actor.anim.playing) {
|
||||
actor.anim.apply(*actor.st.sprite, actor.pos);
|
||||
actor.text.setPosition(actor.pos);
|
||||
actor.text.setScale({actor.scale_x, actor.scale_y});
|
||||
actor.anim.apply(actor.text, actor.pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sf::Vector2f Engine::position_sprite(textures::SpriteTexture& st, const std::string& cell_name, float scale_x, float scale_y, bool at_mid, float x_diff, float y_diff) {
|
||||
|
||||
auto& cell = $ui.cell_for(cell_name);
|
||||
float x = float(at_mid ? cell.mid_x : cell.x);
|
||||
float y = float(at_mid ? cell.mid_y : cell.y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue