game.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "engine/engine.h"
  3. #include <game/world.h>
  4. #include <game/level.h>
  5. #include <game/enemy.h>
  6. #include "flip_world.h"
  7. #include "flip_storage/storage.h"
  8. #define PLAYER_COLLISION_VERTICAL 5
  9. #define PLAYER_COLLISION_HORIZONTAL 5
  10. typedef struct
  11. {
  12. Vector trajectory; // Direction player would like to move.
  13. float radius; // collision radius
  14. int8_t dx; // x direction
  15. int8_t dy; // y direction
  16. Sprite *sprite_right; // player sprite
  17. Sprite *sprite_left; // player sprite looking left
  18. bool is_looking_left; // player is looking left
  19. //
  20. uint32_t xp;
  21. uint32_t level;
  22. uint32_t health;
  23. //
  24. uint32_t strength; // for later uppdate
  25. } PlayerContext;
  26. typedef struct
  27. {
  28. float fps;
  29. PlayerContext *player;
  30. } GameContext;
  31. extern const EntityDescription player_desc;
  32. void player_spawn(Level *level, GameManager *manager);
  33. // Get game context: GameContext* game_context = game_manager_game_context_get(manager);