aboutsummaryrefslogtreecommitdiff
path: root/include/player.h
blob: b26bc207704b970784db41624669529d3487207f (plain)
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
33
#pragma once

#include "raylib.h"
#include "raytmx.h"

#include "map.h"

typedef enum { PLAYER_IDLE, PLAYER_WALK, PLAYER_ATTACK, PLAYER_DIE, PLAYER_FALL } PlayerState;

typedef struct {
  int potions;
  int bombs;
  int currency;
} Inventory;

typedef struct {
  Vector2 position;
  float speed;
  Rectangle bounds;

  TmxTileset tileset;
  int currentFrame;
  float frameTime;
  PlayerState state;
  bool facingRight;

  int health;
  int maxHealth;
  Inventory inventory;
} Player;

void UpdatePlayer(Player *player, Map *map, struct Entities *entities);
void DrawPlayer(Player *player);