r/AskProgramming•
YoungSith

How to lose at the game I'm programming in C language?

I'm programming this Maze game for a project at school, I have everything, my enemies move randomly but I'm trying to do that when my player touches one enemy immediatly call the function youLose();

I have this:

for(i=0; i<E; i++)
    if(player1.posR  == enemies.posR[i] && player1.posC == enemies.posC[i])
        youLose();

and these are my structures:

typedef struct{
    int posC;
    int posR;
    int color;
    int score;
    int lives;
}player;

typedef struct{ int posC; int posR; int color; }enemy;

but it says: error: request for member 'posR' in 'enemies', which is of non-class type 'enemy*'|

I don't know what I'm doing wrong :/

Posted May 29, 2016, 7:25 PM UTC

02
Loading comments…