game.h 1022 B

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. float fps;
  13. //
  14. uint32_t xp;
  15. uint32_t level;
  16. uint32_t health;
  17. //
  18. uint32_t strength; // for later uppdate
  19. uint32_t defense; // for later uppdate
  20. } GameContext;
  21. typedef struct
  22. {
  23. Vector trajectory; // Direction player would like to move.
  24. float radius; // collision radius
  25. int8_t dx; // x direction
  26. int8_t dy; // y direction
  27. Sprite *sprite_right; // player sprite
  28. Sprite *sprite_left; // player sprite looking left
  29. bool is_looking_left; // player is looking left
  30. } PlayerContext;
  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);