Exemple #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);
     }
 }
Exemple #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();
            }
        }
Exemple #3
0
 public bool checkQuestion(RenderWindow win, Hero h, Wolf w, Eagle e)
 {
     foreach (Text button in mas)
     {
         if (Mouse.GetPosition(win).X >= button.Position.X &&
             Mouse.GetPosition(win).X <= button.GetGlobalBounds().Width + button.Position.X &&
             Mouse.GetPosition(win).Y <= button.Position.Y + button.GetGlobalBounds().Height + 20 &&
             Mouse.GetPosition(win).Y >= button.Position.Y)
         {
             button.FillColor = Color.Green;
             if (Mouse.IsButtonPressed(Mouse.Button.Left))
             {
                 if (button.DisplayedString == finalAnswer)
                 {
                     w.sprt.Position = new Vector2f(0, 0);
                     e.sprt.Position = new Vector2f(e.currentX, e.currentY);
                     Beast.stay      = false;
                     lockQuestion    = true;
                     return(true);
                 }
                 else if (button.DisplayedString != finalAnswer)
                 {
                     h.life         -= 1;
                     w.sprt.Position = new Vector2f(0, 0);
                     e.sprt.Position = new Vector2f(300, 300);  //////////////////////////ПОФИКСИТЬ ПОЛОЖЕНИЕ ОРЛА ПОСЛЕ СБРОСА ВОПРОСА
                     lockQuestion    = true;
                     Beast.stay      = false;
                     return(false);
                 }
             }
             else
             {
             }
         }
         else
         {
             button.FillColor = Color.Red;
         }
     }
     return(false);
 }
Exemple #4
0
 public void drawAll(RenderWindow win, Hero h, Eagle e, Wolf w)
 {
     win.Draw(h.sprt);
     win.Draw(w.sprt);
     win.Draw(e.sprt);
 }