enemy.h 861 B

123456789101112131415161718192021
  1. #pragma once
  2. #include "game.h"
  3. #include "flip_world.h"
  4. // EnemyContext definition
  5. typedef struct
  6. {
  7. char id[64]; // Unique ID for the enemy type
  8. int index; // Index for the specific enemy instance
  9. Vector trajectory; // Direction the enemy moves
  10. Sprite *sprite_right; // Enemy sprite when looking right
  11. Sprite *sprite_left; // Enemy sprite when looking left
  12. bool is_looking_left; // Whether the enemy is facing left
  13. float radius; // Collision radius for the enemy
  14. float x; // X position
  15. float y; // Y position
  16. float width; // Width of the enemy
  17. float height; // Height of the enemy
  18. } EnemyContext;
  19. const EntityDescription *enemy(GameManager *manager, const char *id, int index, float x, float y, float width, float height, bool moving_left);