Advertisement
Guest User

Untitled

a guest
Aug 15th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <conio.h>
  4. #include "gameboard.h"
  5. #include "hero.h"
  6. using namespace std;
  7.  
  8. //person::person() {}
  9. //person::person(int h, int p, int x, int y) : hp(h), attackPwr(p), xCo(x), yCo(y) {}
  10. void person::move(){
  11.     char dir = 'x';
  12.  
  13.     cout << "Type Enter to quit\n";
  14.  
  15.     while (dir != '\r'){
  16.         cout << "\nYour location is x" << xCo <<",y" << yCo;
  17.         cout << "\nPress direction key(n,s,e,w):";
  18.  
  19.         dir = getche();
  20.  
  21.         switch(dir){
  22.             case 'n':
  23.                 yCo++;
  24.                 break;
  25.             case 's':
  26.                 yCo--;
  27.                 break;
  28.             case 'e':
  29.                 xCo++;
  30.                 break;
  31.             case 'w':
  32.                 xCo--;
  33.                 break;
  34.         }
  35.         currentCords();
  36.         show();
  37.     }
  38. }
  39.  
  40. void person::currentCords(){
  41.     board[xCo][yCo] = 178;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement