3 #include "../game/game.h"
4 #include "../score/score.h"
6 static struct entity apple;
8 static void apple_step(struct entity *self, struct entity_step_data stepdata)
10 if (stepdata.dx == 0 && stepdata.dy == 0) {
12 add_health(&player, 1);
17 static void spawn_apple(int x, int y)
19 spawn(apple, x, y, NULL);
22 __attribute__((constructor)) static void init()
24 apple = (struct entity) {
28 .color = get_color("#FF2A53"),
34 .collide_with_entities = false,
36 .on_step = &apple_step,
38 .on_collide_with_entity = NULL,
45 register_air_function((struct generator_function) {
47 .callback = &spawn_apple,