Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ship.h"
- void ship::clearPos(int a,int b){
- map[a-1][b-1]=' ';
- map[a-1][b]=' ';
- map[a-1][b+1]=' ';
- map[a][b-1]=' ';
- map[a][b]=' ';
- map[a][b+1]=' ';
- map[a+1][b-1]=' ';
- map[a+1][b]=' ';
- map[a+1][b+1]=' ';
- }
- void ship::renderShip(int a,int b){
- map[a-1][b-1]=pup1;
- map[a-1][b]='^';
- map[a-1][b+1]=pup2;
- map[a][b-1]='<';
- map[a][b]='@';
- map[a][b+1]='>';
- map[a+1][b-1]=pup3;
- map[a+1][b]='#';
- map[a+1][b+1]=pup4;
- }
- ship::ship(){
- hitPoints=100;
- damage=10;
- bullets=1;
- pup1=' '; pup2=' '; pup3=' '; pup4=' ';
- };
- void ship::moveUp(int a,int b){
- clearPos(a,b);
- renderShip(a-1,b);
- }
- void ship::moveDown(int a,int b){
- clearPos(a,b);
- renderShip(a+1,b);
- }
- void ship::moveRight(int a,int b){
- clearPos(a,b);
- renderShip(a,b+1);
- }
- void ship::moveLeft(int a,int b){
- clearPos(a,b);
- renderShip(a,b-1);
- }
Add Comment
Please, Sign In to add comment