3 #include "../game/game.h"
5 static struct entity apple;
7 static void apple_step(struct entity *self, struct entity_step_data stepdata)
9 if (stepdata.dx == 0 && stepdata.dy == 0) {
11 add_health(&player, 1);
16 static void spawn_apple(int x, int y)
18 spawn(apple, x, y, NULL);
21 __attribute__((constructor)) static void init()
23 apple = (struct entity) {
27 .color = get_color("#FF2A53"),
33 .collide_with_entities = false,
35 .on_step = &apple_step,
37 .on_collide_with_entity = NULL,
44 register_air_function((struct generator_function) {
46 .callback = &spawn_apple,