game.h 753 B

12345678910111213141516171819202122232425262728
  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 score;
  12. } GameContext;
  13. typedef struct
  14. {
  15. Vector trajectory; // Direction player would like to move.
  16. float radius; // collision radius
  17. int8_t dx; // x direction
  18. int8_t dy; // y direction
  19. Sprite *sprite_right; // player sprite
  20. Sprite *sprite_left; // player sprite looking left
  21. bool is_looking_left; // player is looking left
  22. } PlayerContext;
  23. extern const EntityDescription player_desc;
  24. void player_spawn(Level *level, GameManager *manager);