Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. static void MovePlayer(int PlayerNo, int Distance, char Direction)
  2. {
  3. for (int i = 0; i < AmountOfPlayers; i = i + 1)
  4. {
  5. PlayerNo = i;
  6.  
  7. Distance = DiceThrow();
  8.  
  9. Direction = Console.ReadKey().KeyChar;
  10.  
  11. Console.WriteLine("U = up D = down R = right L = left");
  12.  
  13. switch (Direction)
  14. {
  15. case 'U':
  16. Players[PlayerNo].Y = Players[i].Y - Distance;
  17.  
  18. if (Players[i].Y < 0)
  19. {
  20. Players[i].Y = Players[i].Y + 8;
  21. }
  22. break;
  23.  
  24. case 'D' :
  25. Players[PlayerNo].Y = Players[i].Y + Distance;
  26.  
  27. if (Players[i].Y < 0)
  28. {
  29. Players[i].Y = Players[i].Y - 8;
  30. }
  31. break;
  32.  
  33. case 'L':
  34. Players[PlayerNo].X = Players[i].X - Distance;
  35.  
  36. if (Players[i].X < 0)
  37. {
  38. Players[i].X = Players[i].X + 8;
  39. }
  40. break;
  41. case 'R' :
  42. Players[PlayerNo].X = Players[i].X + Distance;
  43.  
  44. if (Players[i].X < 0)
  45. {
  46. Players[i].X = Players[i].X - 8;
  47. }
  48. break;
  49.  
  50. default :
  51. Console.WriteLine("Please use U D R or L for as movement characters.");
  52. continue;
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement