Пример #1
0
        //c'tor
        public GameManager(Canvas cnv)
        {
            _myCanvas = cnv;

            RoadAndRiverElements = new Entity[NUM_OF_ROAD_AND_RIVER_ELEMENTS][];

            managerTimer          = new DispatcherTimer();
            managerTimer.Interval = TimeSpan.FromTicks(1);

            _bigFrogger           = new Frogger[5];
            _bigFroggerIsOccupied = new bool[5];
            for (int i = 0; i < _bigFrogger.Length; i++)
            {
                _bigFrogger[i] = new Frogger();

                _bigFrogger[i].Image.Source = new BitmapImage(new Uri(@"ms-appx:///Assets/froghead.png "));
                _bigFrogger[i].Image.Height = 100;
                _bigFrogger[i].Image.Width  = 100;

                _bigFrogger[i].Location = new Point(118 + i * 500, 40);
                Canvas.SetLeft(_bigFrogger[i].Image, _bigFrogger[i].Location.X);
                Canvas.SetTop(_bigFrogger[i].Image, _bigFrogger[i].Location.Y);

                _bigFroggerIsOccupied[i] = false;
            }
        }
Пример #2
0
        //fonctions

        public void StartNewGame()
        {
            _frogi = new Frogger();
            _myCanvas.Children.Add(_frogi.Image);
            _bigFrogCounter          = 0;
            _flagWin                 = false;
            _flagDead                = false;
            _flagFrogiOnRiverElement = false;
            _isKing = false;
            CreateElements();

            managerTimer.Tick += Timer_Tick;
            managerTimer.Start();
        }