Witam, zaczynam przerabiać książkę pt"C# rusz głową".Aktualnie napisałem już kod dla elpisy.

Poszukuje odpowiedzi co zmienić w kodzie żeby elipsa odbijała się w różnych miejscach a nie w jednej lini.Kod nadsyłam na dole:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace Ratuj_Ludzi_
{
/// <summary>
/// Logika interakcji dla klasy MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Random random = new Random();

    }

    private void startButton_Click(object sender, RoutedEventArgs e)
    {
       
        
            AddEnemy();
        
        
    }


    private void AddEnemy()
    {

        
        
            ContentControl enemy = new ContentControl();
            enemy.Template = Resources["enemyTemplate"] as ControlTemplate;
            AnimateEnemy(enemy, 0, playArea.ActualWidth - 100, "(Canvas.Left)");
            AnimateEnemy(enemy, 1, 10, "(Canvas.Top)");

            playArea.Children.Add(enemy);
        
    }

    public void AnimateEnemy(ContentControl enemy, double from, double to, string propertyToAnimate)
    {
        
        
            Random random = new Random();
        Storyboard storyboard = new Storyboard() { AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever };
        DoubleAnimation animation = new DoubleAnimation()
        {
            From = from,
            To = to,
            Duration = new Duration(TimeSpan.FromSeconds(random.Next(4, 6)))


        };
        Storyboard.SetTarget(animation, enemy);
        Storyboard.SetTargetProperty(animation, new PropertyPath(propertyToAnimate));
        storyboard.Children.Add(animation);
        storyboard.Begin();
    
    }
}

}