Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 15th, 2012  |  syntax: C++  |  size: 0.90 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data