Пример #1
0
 /// <summary>
 /// paints the player on screen
 /// </summary>
 static void PaintPlayer()
 {
     SetCords(Player);                     // set curser to player
     if (Alive)                            // if alive
     {
         if (DateTime.Now.Second % 2 == 0) // make player change char
         {
             LC.WriteChar((char)2, 0x34);  // print ☻
         }
         else
         {
             LC.WriteChar((char)1, 0x34); // print ☺
         }
     }
 }
Пример #2
0
        /// <summary>
        /// moves the player
        /// </summary>
        /// <param name="info">how mutch - is left </param>
        public static void PlayerMove(int info)
        {
            // if first time running
            if (first)
            {
                timer.Start();                           // start the timer
                first = false;                           // disable the first run
            }
            SetCords(Player);                            // put curser at player location
            if (Alive)                                   // if alive
            {
                LC.WriteChar(' ', 0x33);                 // remove the player from screen
            }
            int x    = Player.X;                         // set x to player x
            int _new = x + info;                         // set _new to x plus amount to move

            if (_new >= 0 && _new < Console.WindowWidth) // check if its in boundrais
            {
                _Player.X = _new;                        // move player
            }
            PaintPlayer();                               // paint new player
        }