ok i added it to the class and i got these errors
C:\Users\Chay\Desktop\Dinosaur Arena\player.h||In constructor 'player::player()':|
C:\Users\Chay\Desktop\Dinosaur Arena\player.h|56|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h||In member function 'void player::store()':|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|31|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|41|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|51|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|61|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|72|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|73|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|74|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|75|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h||In member function 'void player::backpack()':|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|82|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|83|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|84|error: invalid types 'int[int]' for array subscript|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|85|error: invalid types 'int[int]' for array subscript|
||=== Build finished: 13 errors, 0 warnings ===|
CLASS:
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#ifndef PLAYER_H
#define PLAYER_H
#include <vector>
#include <string>
class player
{
private:
int health;
int pistolAmmo;
int shotgunAmmo;
int rifleAmmo;
int score;
int money;
int items;
//std::vector<std::string> inventory;
public:
void save();
void load();
void MainGame();
void store();
void timer();
void backpack();
player();
~player();
void set_health(int H);
void set_pistolAmmo(int PA);
void set_shotgunAmmo(int SA);
void set_rifleAmmo(int RA);
void set_score(int S);
void set_money(int M);
void set_items(int I);
//void set_inventory(std::vector<std::string> I);
int get_health();
int get_pistolAmmo();
int get_shotgunAmmo();
int get_rifleAmmo();
int get_score();
int get_money();
int get_items();
//std::vector<std::string> get_inventory();
};
player::player()
{
health = 100;
pistolAmmo = 17;
shotgunAmmo = 8;
rifleAmmo = 30;
score = 0;
money = 0;
items[4] = {0,0,0,0};
}
player::~player()
{
//Empty Deconstructor
}
void player::set_health(int H)
{
health = H;
}
void player::set_pistolAmmo(int PA)
{
pistolAmmo = PA;
}
void player::set_shotgunAmmo(int SA)
{
shotgunAmmo = SA;
}
void player::set_rifleAmmo(int RA)
{
rifleAmmo = RA;
}
void player::set_score(int S)
{
score = S;
}
void player::set_money(int M)
{
money = M;
}
void player::set_items(int I)
{
items = I;
}
int player::get_health()
{
return health;
}
int player::get_pistolAmmo()
{
return pistolAmmo;
}
int player::get_shotgunAmmo()
{
return shotgunAmmo;
}
int player::get_rifleAmmo()
{
return rifleAmmo;
}
int player::get_score()
{
return score;
}
int player::get_money()
{
return money;
}
int player::get_items()
{
return items;
}
#endif // PLAYER_H
| |