Пример #1
0
 public Level1(Window window, Canvas canvas, Player player, Boolean load)
 {
     this.window = window;
     this.canvas = canvas;
     this.load   = load;
     enemies     = new List <Enemies>();
     if (load == true)
     {
         Level1.loadLevel1(this.canvas, this.window, player);
         this.player = player;
     }
 }
Пример #2
0
        public GameWindow(Boolean load)
        {
            this.Closed  += GameWindow_Closed;
            this.Closing += GameWindow_Closing;

            InitializeComponent();
            this.loaded = load;

            backgroundImage.Width  = 860;
            backgroundImage.Height = 650;
            mediaElement.Source    = new Uri("audio/main2.wav", UriKind.Relative);
            mediaElement.BeginInit();
            mediaElement.Position = TimeSpan.FromSeconds(1);
            //mediaElement.Stop();
            mediaElement.Volume = 0.07;
            //mediaElement.MediaOpened += new RoutedEventHandler(Element_MediaOpened);
            mediaElement.Play();
            mediaElement.MediaEnded += new RoutedEventHandler(Element_MediaEnded);
            //mediaElement.Play();
            //


            if (loaded == true)
            {
                lv1 = new Level1(this, canvas, player, true);
            }
            else
            {
                Image playerPic = new Image();
                playerPic.Source = UtilityMethods.LoadImage("pics/galaga_ship.png");
                ImageBehavior.SetAnimatedSource(playerPic, playerPic.Source);
                playerPic.Width  = 42;
                playerPic.Height = 46;
                canvas.Children.Add(playerPic);
                Canvas.SetLeft(playerPic, 405);
                Canvas.SetTop(playerPic, 500);
                Point playerPoint = new Point(27, 490);
                player = new Player(playerPoint, playerPic, canvas, 15);
                lv1    = new Level1(this, canvas, player);
                lv1.Play();
            }
            // Level4 lv4 = new Level4(this, canvas, player);
            //lv4.Play();

            KeyDown += new KeyEventHandler(MyGrid_KeyDown);

            DecrementColdDown();
        }