//Selects which picture to be used as the cloud public void picSelector(int i, cloud cloud) { switch (i) { case 1: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/honkscloud.png")); break; case 3: cloud.Img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/catcloud.png")); break; } }
public void makeCloud(cloud cloud) { DoubleAnimation da = new DoubleAnimation(-100, 1280, new Duration(new TimeSpan(0, 0, RandomIntGenerator(3)))); Storyboard story = new Storyboard { /*RepeatBehavior = RepeatBehavior.Forever*/ }; Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)")); story.Children.Add(da); cloud = new cloud(); try { picSelector(RandomIntGenerator(2), cloud); } catch (Exception e) { } int y = RandomIntGenerator(1); Canvas.SetTop(cloud, y); Container.Children.Add(cloud); story.Completed += (s, eArgs) => { Container.Children.Remove(cloud); //makeCloud(cloud); }; cloud.BeginStoryboard(story); }
//Selects which picture to be used as the cloud public void picSelector(int i, cloud cloud) { Uri uri; switch (i) { case 1: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/honkscloud.png")); countnum++; break; case 3: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"../../Resources/kitten.wav", UriKind.Relative); PlaySound(uri); countnum++; break; case 4: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/suzuyacloud.png")); uri = new Uri(@"../../Resources/Suzuya.wav", UriKind.Relative); PlaySound(uri); countnum++; break; case 6: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"../../Resources/Yahallo.wav", UriKind.Relative); PlaySound(uri); countnum++; break; case 7: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/pc.png")); countnum++; break; case 9: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"../../Resources/thunder.wav", UriKind.Relative); PlaySound(uri); s.Seek(TimeSpan.Zero); newhigh = countnum; countnum = 0; break; case 10: cloud.Img.Source = new BitmapImage(new Uri(@"pack://*****:*****@"../../Resources/thunder.wav", UriKind.Relative); PlaySound(uri); s.Seek(TimeSpan.Zero); newhigh = countnum; countnum = 0; break; } count.Text = countnum.ToString(); if (newhigh > highscorenum) { highscorenum = newhigh; highscore.Text = highscorenum.ToString(); } }
private void ResetBtn_Click(object sender, RoutedEventArgs e) { cloud cloud = new cloud(); makeCloud(cloud); }
public void helper(cloud cloud2) { makeCloud(cloud2); makeCloud(cloud3); }