paul gallienne

paul gallienne

  • NA
  • 2
  • 2.3k

wpf storyboard game problem

Mar 7 2014 12:04 AM
hi people
 
 
i am trying to make a matching game with storyboards.
 
i made it  in blend  and using visual studio.
 
i am triggering  the storyboards from the code behind.
 
i am using storyboard.completed to match two pictures when they match they disappear with a timer.
 
i am also using storyboard .completed to make the storyboards go back to the start if they don't match.
 
it works but my problem is if they don't match = (storyboard.stop)  it gos back to the stat like it should but then on the second click it always gos back to the start ? i need it to reset so you can try different ones ? 
 
here is the code = 
 
 
           private void click1(object sender, StylusDownEventArgs e)   
   {
           Storyboard monkyspin = (Storyboard)FindResource("monkyspin");  
 
         Storyboard catspin = (Storyboard)FindResource("catspin");
  
monkyspin.Begin();
         catspin.Completed +=if_cat_cop_stop;        
        }
 
        private void if_cat_cop_stop(object sender, EventArgs e)      
       {        
        Storyboard monkyspin = (Storyboard)FindResource("monkyspin");  
        monkyspin.Stop();    
        monkyspin = new Storyboard();
        Storyboard catspin = (Storyboard)FindResource("catspin");  
        catspin.Stop();      
        catspin = new Storyboard();   
        }

and i do the same but the other way round for button 2

any ideas ?

thaks paul