Adilol

Need to implement this

Sep 7th, 2011
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9.     class Movements : Info
  10.     {
  11.         public void Action()
  12.         {
  13.  
  14.             //This cleans up player after it moves
  15.             Console.SetCursorPosition(x, y);
  16.             Console.Write("   ");
  17.             x = x + xspeed;
  18.             y = y + yspeed;
  19.  
  20.             //this is the control input from the player
  21.             if (Console.KeyAvailable)
  22.             {
  23.                 ConsoleKeyInfo Keyinfo = Console.ReadKey(true);
  24.                 switch (Keyinfo.Key)
  25.                 {
  26.                     case ConsoleKey.W:
  27.                         y = y - 1;
  28.                         figure = "^.^";
  29.                         break;
  30.                     case ConsoleKey.S:
  31.                         y = y + 1;
  32.                         figure = "v.v";
  33.                         break;
  34.                     case ConsoleKey.A:
  35.                         x = x - 1;
  36.                         figure = "<.<";
  37.                         break;
  38.                     case ConsoleKey.D:
  39.                         x = x + 1;
  40.                         figure = ">.>";
  41.                         break;
  42.                     case ConsoleKey.T:
  43.                         pla.Screen();
  44.                         break;
  45.                 }
Advertisement
Add Comment
Please, Sign In to add comment