So I was watching a tutorial where a guy did this but on iOS. I tried the same here on Windows and there are some errors. Any sugestion to fix this ?
structs:
Code:
///////////////////////////////////////////////////////
//STRUCT FOR PLAYER DATAS
///////////////////////////////////////////////////////
typedef struct
{
float x, y;
float dx, dy;
short life;
char *name;
int onLedge;
int animFrame, facingLeft, slowingDown;
} Player;
///////////////////////////////////////////////////////
//STRUCT FOR LEDGE
///////////////////////////////////////////////////////
typedef struct
{
int x, y, w, h;
} Ledge;
///////////////////////////////////////////////////////
//STRUCT GAMESTATE
///////////////////////////////////////////////////////
typedef struct
{
//Players
Player PL[2];
//Ledges
Ledge ledges[100];
//Images
SDL_Texture *manFrames[2];
SDL_Texture *brick;
int time;
//Renderer
SDL_Renderer *renderer;
} GameState;
Function of the problem:
Code:
void process(GameState *game)
{
//add time
game->time++;
//man movement
Player *PL[0] = &game->PL[0]; //Invalid initializer
game.PL[0].x += game.PL[0].dx; //Error: Request for member 'PL' in something not a structure or union
game.PL[0].y += game.PL[0].dy;
if(PL[0]->dx != 0 && PL[0]->onLedge && !PL[0]->slowingDown)
//////////////////////////////////////////