Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chained Animations #58

Open
madrury opened this issue Feb 25, 2024 · 0 comments
Open

Chained Animations #58

madrury opened this issue Feb 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@madrury
Copy link
Owner

madrury commented Feb 25, 2024

Throwing a rod of fire currently looks like this:

fire-rod-throw

There are two issues we'd like to fix here.

Animation and Entity Spawning Order

The fire entities spawned by the throw effect spawn, and hence are rendered, before the animation completes. This is because we process the entity spawn buffer before entering the AnimationPlaying game state:

process_entity_spawn_request_buffer(&mut self.ecs);
let mut new_animations = AnimationInitSystem{};
new_animations.run_now(&self.ecs);
let mut new_particles = ParticleInitSystem{};
new_particles.run_now(&self.ecs);
self.ecs.maintain();

This is a bit more involved to fix than may be evident. We use a distinct game state when running animations, so we want to delay clearing the buffer until completing our work in this state. We currently don't always enter this state at the end of a {Player|Hazard|Monster} turn, so simply deferring clearing the buffer until the end of animation states doesn't quite work. (It may be possible to simply always transition to the animation state and let it be a no-op if the buffer is empty.

Chained Animations

Notably missing is the nice explosion animations when we throw a fire potion, and notably missing from the fire potion animation is throwing the potion itself. Kinda lame.

We need a notion of chained animations here, some algebra allowing us to concatenate animation requests. We'd like to be able to express the throw animation as something like:

AnimationRequest::from_chain(AlongRayAnimation {..}, AreaOfEffect {..})

This is a bit tricky because we don't know the length of the animation at the time of making the request.

@madrury madrury added the enhancement New feature or request label Feb 25, 2024
@madrury madrury mentioned this issue Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant