all repos — hyperkaos @ 1d7fe3d8c9679faf818524248c9d7ccfbc6791ce

lightweight modular puzzle/adventure game engine in C with SDL 1.2

Player.h (raw)

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
typedef struct room Room;

typedef struct
{
  int x, y;
} Coord;

typedef struct player
{
    Coord point;
    Coord bearing;

    SDL_Rect boundBox;
    SDL_Rect frontFaceBox;

    SDL_Surface* spriteSheet;
    SDL_Rect clip;
    int counter;

    int tombStone;
} Player;

Player* newPlayer(char* filename, int a, int b);
void killPlayer(Player* target);

void movePlayer(Player* self, Room* rightHere);
void drawPlayer(Player* self);
void walkAnim(Player* self);

int playerFaces(Player* self, char dir);
int playerIsInRect(Player* self, SDL_Rect* rect);
int playerFacesRect(Player* self, SDL_Rect* rect);