game.h 976 B

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