Ive Tried using a blank contructor function
Player:
layer()
{
}
But that still gives the same error
Ill add the class below
Player.h
// Credit goes to Fishstick for extending my Player Class
class Player
{
public:
int GetMana(void);
int GetHealth(void);
void SetMana(int iAmount);
void SetHealth(int iAmount);
void Render3rd(void);
void Render1st(void);
int GetPosX(void);
int GetPosY(void);
int GetPosZ(void);
void SetAxis(float X, float Y);
void Move(int Dir);
void SnapToTerrain(int X, int Z);
void Debug(int X, int Y, int Z);
void DoCrouch(int I);
Player();
void InitPlayer(int PlayerID, float X, float Y, float Z, int Type);
~Player();
private:
int ID;
int MP;
int HP;
float AxisX;
float AxisY;
float PosX;
float PosY;
float PosZ;
float BaseY;
};
Player.cpp
// see above attachment for Credit.
#include "Player.h"
#include "DarkGDK.h"
#include "InputKeys.h"
#include "SC_Collision.h"
int Player::GetHealth(void)
{
return HP;
}
int Player::GetMana(void)
{
return MP;
}
void Player::SetHealth(int iAmount)
{
HP = iAmount;
}
void Player::SetMana(int iAmount)
{
MP = iAmount;
}
int Player::GetPosX(void)
{
return PosX;
}
int Player::GetPosY(void)
{
return PosY;
}
int Player::GetPosZ(void)
{
return PosZ;
}
float fCameraAngleX = 0;
float fCameraAngleY = 0;
float AxisX = 0;
float AxisY = 0;
void Player::SetAxis(float X, float Y)
{
AxisX = X;
AxisY = Y;
//if (AxisX > 90.0 && AxisX < 180.0){AxisX = 90.0;}
//if (AxisX < 270.0 && AxisX > 180.0){AxisX = 270.0;}
dbXRotateCamera (AxisX);
dbYRotateCamera (AxisY);
}
void Player::Move(int Dir)
{
if (Dir == 0){
PosX += (float) sin(AxisY * (3.14/180)) * 0.4;
PosZ += (float) cos(AxisY * (3.14/180)) * 0.4;}
if (Dir == 1){
PosX -= (float) sin(AxisY * (3.14/180)) * 0.4;
PosZ -= (float) cos(AxisY * (3.14/180)) * 0.4;}
if (Dir == 2){
PosX += (float) sin(dbWrapValue(AxisY-90.0) * (3.14/180)) * 0.4;
PosZ += (float) cos(dbWrapValue(AxisY-90.0) * (3.14/180)) * 0.4;}
if (Dir == 3){
PosX -= (float) sin(dbWrapValue(AxisY-90.0) * (3.14/180)) * 0.4;
PosZ -= (float) cos(dbWrapValue(AxisY-90.0) * (3.14/180)) * 0.4;}
}
void Player::SnapToTerrain( int TileX, int TileZ)
{
dbGetMatrixHeight (1, TileX, TileZ);
}
Player::Player()
{
}
void Player::InitPlayer(int PlayerID, float X, float Y, float Z, int Type)
{
ID = PlayerID;
dbSetCameraRange(1,30000);
HP = 100;
MP = 100;
PosX = X;
PosY = Y;
PosZ = Z;
BaseY = 100.0;
if (!Type){
dbMakeObjectCube(501, 100.0);
SC_SetupObject(501, 2, 0);
dbColorObject(501, dbRGB(255, 50, 50));
dbSetAlphaMappingOn(501, 0);
dbMakeLight(1);}
else {
dbMakeObjectCube(1000, 100.0);
SC_SetupObject(1000, 1, 0);
dbColorObject(1000, dbRGB(255, 50, 50));
dbMakeObjectPlain(2001, 80.0, 20.0);
dbColorObject(2001, dbRGB(0, 255, 0));}
}
void Player::DoCrouch(int I)
{
if (I){BaseY = 56.0;}
else {BaseY = 100.0;}
}
void Player::Render1st()
{
SC_UpdateObject(501);
dbPositionCamera(PosX, PosY+BaseY, PosZ);
dbPositionObject(501, PosX, PosY+(BaseY/2), PosZ);
dbRotateObject(501, 0, AxisY, 0);
dbPositionLight(1, PosX, PosY+(BaseY/2), PosZ);
dbSetSpotLight(1, 30, 90);
dbRotateLight(1, AxisX, AxisY, 0);
}
void Player::Render3rd()
{
SC_UpdateObject(1000);
dbPositionObject(1000, PosX, PosY+(BaseY/2), PosZ);
dbRotateObject(1000, 0, AxisY, 0);
dbPositionObject(2001, PosX, PosY+BaseY+20.0, PosZ);
dbRotateObject(2001, 0, dbWrapValue(dbCameraAngleY()-180.0), 0);
dbScaleObject(2001, HP, 100, 100);
}
Player::~Player()
{
}
wasnt sure what parts would be valid to the question so the lot got attached >.> who knows might be of use to someone.
EDIT: To clarify ive used a various number of methods to try and create a player inside of an array.
Player ArrayName[5];
ArrayName[1] = MainPlayer;
or
Player PlayerList[20];
Player MainPlayer();
PlayerList[1] = MainPlayer;
PlayerList[1].InitPlayer(0, 0, 0, 0, 0);
Player SecondaryPlayer();
PlayerList[2] = SecondaryPlayer;
PlayerList[2].InitPlayer(1, 10, 0, 10, 1);
And a few others ;/ I just cant seem to get it to compile and work.
EDIT AGAIN: I should note that the error changed and i forgot to mention it >.> to many things going on at once
class Player __cdecl MainPlayer(void)" (?MainPlayer@@YA?AVPlayer@@XZ) referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
is the error we are getting, we know MainPlayer isnt a real function, But to declare it normally without trying to save this to an array we can use
Player MainPlayer();
to create the Class object ;/
So im stuck and confused,
Stuck in the land of the confused! and loving it!