game.h 1000 B

123456789101112131415161718192021222324252627282930313233343536
  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. uint32_t xp;
  13. uint32_t level;
  14. uint32_t health;
  15. //
  16. uint32_t strength; // for later uppdate
  17. uint32_t defense; // for later uppdate
  18. } GameContext;
  19. typedef struct
  20. {
  21. Vector trajectory; // Direction player would like to move.
  22. float radius; // collision radius
  23. int8_t dx; // x direction
  24. int8_t dy; // y direction
  25. Sprite *sprite_right; // player sprite
  26. Sprite *sprite_left; // player sprite looking left
  27. bool is_looking_left; // player is looking left
  28. } PlayerContext;
  29. extern const EntityDescription player_desc;
  30. void player_spawn(Level *level, GameManager *manager);
  31. // Get game context: GameContext* game_context = game_manager_game_context_get(manager);