1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <string>
#include <iostream>
#include "player.h"
Player::Player()
{
name = "new_player";
level = 1;
dps, def = 50;
Position.x = 0; Position.y = 0;
}
Player::Player(const Player &obj)
{
name = obj.name;
level = obj.level;
dps = obj.dps;
def = obj.def;
}
Player::~Player()
{
cout << "mort du joueur" << endl;
}
void Player::move(int x, int y)
{
Position.x = x;
Position.y = y;
cout << "Le Joueur " << name << " bouge vers " << Position.x << ", " << Position.y << endl;
}
int main(void)
{
cout << "Nouvelle Partie !!" << endl;
int i;
cout << "Nombre des joueurs: 2 3 Ou 4?" << endl;
cin >> i;
switch(i)
{
case 2: {Player P1, P2; break;}
case 3: {Player P1, P2, P3; break;}
case 4: {Player P1, P2, P3, P4; break;}
}
Player P5;
int x, y;
cout << "entrez les coordonnées ou vous voulez faire bouger votre joueur: " << endl;
cin >> x; cin >> y;
P5.move(x,y);
return 0;
} |
Partager