1
SFML projects / Re: Thor 2.0 released!
« on: May 15, 2016, 02:32:34 am »
I have some questions regarding the animations library.
It seems like I am not able to play differrent animations for different sprites at the same time.
I have 2 entities ( 1 Player, 1 NPC ), the players movement is triggered by user input. The NPC just moves to random coordinates. Both entities call a function from my AnimationHandler => PlayAnimation(string animationId, Sprite sprite, bool loop = false), where animationId is the id of the animation to play on the given sprite.
This function runs PlayAnimation(animationId, loop) on the animator and adds the given Sprite to a list.
Then in the game loop I call the animate and the update function of my AnimationHandler, the update function triggers the update of the animator, the animate function runs trough a list of sprites and animates them.
This works perfect for 1 entity, but as i try to handle 2 entities with different animations running, it doesnt seem to work. How am I able to build an working AnimationHandler for more than 1 entity?
//Edit:
I already fixed my problem.
It seems like I am not able to play differrent animations for different sprites at the same time.
I have 2 entities ( 1 Player, 1 NPC ), the players movement is triggered by user input. The NPC just moves to random coordinates. Both entities call a function from my AnimationHandler => PlayAnimation(string animationId, Sprite sprite, bool loop = false), where animationId is the id of the animation to play on the given sprite.
This function runs PlayAnimation(animationId, loop) on the animator and adds the given Sprite to a list.
Then in the game loop I call the animate and the update function of my AnimationHandler, the update function triggers the update of the animator, the animate function runs trough a list of sprites and animates them.
This works perfect for 1 entity, but as i try to handle 2 entities with different animations running, it doesnt seem to work. How am I able to build an working AnimationHandler for more than 1 entity?
//Edit:
I already fixed my problem.