Exemplo n.º 1
0
 public void updateAll(RenderWindow win, Hero h, Eagle e, Wolf w, Wall wal, Carrot car, Time t, Clock c, Points p,
                       AnswersAndQuestions quest)
 {
     if (check(h, w, e))
     {
         Beast.stay = true;
         quest.setQuestion();
     }
     if (!check(h, w, e))
     {
         Beast.stay = false;
     }
     if (Beast.stay == false)    //если зайца не поймали,то тогда рисуем всё
     {
         wal.update(win);
         p.update(win);
         car.update(win, h);
         h.update(win, wal);
         e.update(win, h, t, c);
         w.update(h, win);
         drawAll(win, h, e, w);
     }
     else     //если зайца поймали то тогда ничего не рисуем и останавливаем всех персонажей
     {
         h.sprt.Position = new Vector2f(h.sprt.Position.X, h.sprt.Position.Y);
         e.sprt.Position = new Vector2f(e.sprt.Position.X, e.sprt.Position.Y);
         w.sprt.Position = new Vector2f(w.sprt.Position.X, w.sprt.Position.Y);
         quest.showQuestion(win);
         quest.checkQuestion(win, h, w, e);
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(510, 600), "ddd");
            Wall         w      = new Wall(39);
            Hero         h      = new Hero();
            Wolf         wolf   = new Wolf();
            Eagle        bird   = new Eagle();
            Time         t      = new Time();
            Clock        c      = new Clock();
            Carrot       car    = new Carrot(w);

            window.SetVerticalSyncEnabled(true);
            window.SetMouseCursorVisible(true);
            Points    pp        = new Points();
            Creatures creatures = new Creatures();

            Beast.stay = false;
            AnswersAndQuestions quest = new AnswersAndQuestions();
            bool deadAll = false;
            Over over    = new Over();

            while (window.IsOpen)
            {
                Console.WriteLine(h.life);
                t = c.ElapsedTime;
                window.DispatchEvents();
                window.Clear();
                if (car.points < 190 && deadAll == false)
                {
                    creatures.updateAll(window, h, bird, wolf, w, car, t, c, pp, quest);
                }
                if (car.points >= 190)
                {
                    if (!deadAll)
                    {
                        c.Restart();
                        deadAll = true;
                    }
                    over.GameGood(ref window, ref t);
                    //ДОБАВИТЬ ХОРОШУЮ КОНЦОВУ
                }
                if (h.life == 0)
                {
                    if (!deadAll)
                    {
                        deadAll = true;
                        c.Restart();
                    }
                    over.GameOver(ref window, ref t);
                    //ДОБАВИТЬ ПЛОХУЮ КОНЦОВКУ
                }
                window.Display();
            }
        }