I am working on a XNA WP7 card game whose basic prototype is complete. In game screen, 6 cards are displayed at a time (3 for each of the two players say 1,2 and 3).
If player A attacks one of player B's card then I want to show an animation over player B's card i.e the victim card(say a claw scratch for e.g.)
My question is how do I approach with the animation system so that I can draw an animation over a card upon certain events e.g. dead, fire, claw attack etc.
I have an attack function which detects which type of card is attacking which type of card. Depending on the type of attacker card I want to display the animation on the victim card.
Can I call animation classes function for different animations in the attack function itself without actually having to call separate draw and update functions. If so, how?
Also how do I play sound at the same time when the animation is going on?
EDIT- Heres what I have done.
I took your advice and created an animation routine in a different class. Here's how it works.
I have a separate Animation.cs class file (where animation occurs)
I have a wrapper class called CardAnimation which has a Dictionary object as animations with animation type as key and animation object as value.
I created a static object of CardAnimation class in Card class so that its not created every time I call animation routine.
I am calling the card's update method from another class called MAINGAMESCREEN.
Here's the flow of Update methods
MAINGAMESCREEN -> CARD -> CARDANIMATION -> ANIMATION
Animation works but it occurs very fast that I can see only first frame. Same animation code works fine in an independent project. What can I do to slow it down?