Hi guys,
Ive got a problem with this class, I'm sure its something stupid again, it helps if someone takes a quick look at your code, as they can usually identify.
So when I try to create a player object, like this, it says "Player is not a typename". Yes I do have the header included aswell.
#ifndef PLAYER_H
#define PLAYER_H
#pragma once
#include<SDL.h>
#include"Labels.h"
class Player
{
public:
int getHealth();
int getStrength();
int getSpeed();
int getDollars();
void draw();
Player(void);
~Player(void);
void handleSDLEvent(SDL_Event const &sdlEvent);
private:
float xpos;
float ypos;
float xsize;
float ysize;
int health;
int strength;
int speed;
int dollars;
Labels* playerLabel;
};
#endif
I assume there is something wrong in my constructor? as its not realising its a type? Not sure, I cant get it to work at all.
In the file I've got the Player.h included in, if I do Player:: it gives me all the things to call, so it recognises it as something.
You can use the same name but then you will have to write class Player in a number of places to make it understand you mean the class and not the variable. Player = newclass Player;
Better to use different names.