Frooster

File 3

Dec 21st, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include "ship.h"
  2.  
  3. void ship::clearPos(int a,int b){
  4.             map[a-1][b-1]=' ';
  5.             map[a-1][b]=' ';
  6.             map[a-1][b+1]=' ';
  7.             map[a][b-1]=' ';
  8.             map[a][b]=' ';
  9.             map[a][b+1]=' ';
  10.             map[a+1][b-1]=' ';
  11.             map[a+1][b]=' ';
  12.             map[a+1][b+1]=' ';
  13.             }
  14.            
  15. void ship::renderShip(int a,int b){
  16.             map[a-1][b-1]=pup1;
  17.             map[a-1][b]='^';
  18.             map[a-1][b+1]=pup2;
  19.             map[a][b-1]='<';
  20.             map[a][b]='@';
  21.             map[a][b+1]='>';
  22.             map[a+1][b-1]=pup3;
  23.             map[a+1][b]='#';
  24.             map[a+1][b+1]=pup4;
  25.             }
  26.            
  27.      ship::ship(){
  28.             hitPoints=100;
  29.             damage=10;
  30.             bullets=1;
  31.             pup1=' '; pup2=' '; pup3=' '; pup4=' ';
  32.             };
  33.            
  34. void ship::moveUp(int a,int b){
  35.             clearPos(a,b);
  36.             renderShip(a-1,b);
  37.             }
  38.        
  39. void ship::moveDown(int a,int b){
  40.             clearPos(a,b);
  41.             renderShip(a+1,b);
  42.             }
  43.        
  44. void ship::moveRight(int a,int b){
  45.             clearPos(a,b);
  46.             renderShip(a,b+1);
  47.             }
  48.        
  49. void ship::moveLeft(int a,int b){
  50.             clearPos(a,b);
  51.             renderShip(a,b-1);
  52.             }
Add Comment
Please, Sign In to add comment