Advertisement
MrHalabaluza

Untitled

Sep 28th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
  2.             switch(keyData){
  3.                 case Keys.Up:
  4.                     if (manY != 0){
  5.                         if (map[manX, manY - 1] != 0) {
  6.                             manY--;
  7.                             this.Refresh();
  8.                         }
  9.                     }
  10.                     break;
  11.                 case Keys.Left:
  12.                     if (manX != 0) {
  13.                         if (map[manX - 1, manY] != 0) {
  14.                             manX--;
  15.                             this.Refresh();
  16.                         }
  17.                     }
  18.                     break;
  19.                 case Keys.Down:
  20.                     if (manY != 7) {
  21.                         if (map[manX , manY + 1] != 0) {
  22.                             manY++;
  23.                             this.Refresh();
  24.                         }
  25.                     }
  26.                     break;
  27.                 case Keys.Right:
  28.                     if (manX != 7) {
  29.                        if (map[manX + 1, manY] != 0) {
  30.                             manX++;
  31.                             this.Refresh();
  32.                        }
  33.                     }
  34.                     break;
  35.             }
  36.             return base.ProcessCmdKey(ref msg, keyData);
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement