+void enemy_tick_fly_straight(struct jumpnrun_enemy *self,
+ struct jumpnrun_game_state *state,
+ struct jumpnrun_level *lv,
+ struct jumpnrun_tile_range const *visible_tiles,
+ vec2d *player_inertia_mod) {
+ int screenpos = fixed_point_cast_int(rectangle_left(&self->base.current_box));
+
+ if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
+ screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
+ return;
+ }
+
+ vec2d new_pos = vec2d_add(enemy_position(self), self->base.inertia);
+ self->type->collision_tiles(self, &new_pos, lv, visible_tiles);
+ self->type->collision_player(self, state, player_inertia_mod);
+ rectangle_move_to(&self->base.current_box, new_pos);
+
+ enemy_animation_advance(self);
+}
+
+void enemy_tick_fly_straight_and_dip(struct jumpnrun_enemy *self,
+ struct jumpnrun_game_state *state,
+ struct jumpnrun_level *lv,
+ struct jumpnrun_tile_range const *visible_tiles,
+ vec2d *player_inertia_mod) {
+ int screenpos = fixed_point_cast_int(rectangle_left(&self->base.current_box));
+
+ if(screenpos + JUMPNRUN_MAX_SPAWN_MARGIN < state->left ||
+ screenpos >= state->left + BADGE_DISPLAY_WIDTH + JUMPNRUN_MAX_SPAWN_MARGIN) {
+ return;
+ }
+
+ if(fixed_point_lt(fixed_point_abs(fixed_point_sub(enemy_position(self).x,
+ state->player.current_box.pos.x)),
+ FIXED_INT(20))) {
+ self->flags |= JUMPNRUN_ENEMY_EVENT_TRIGGER1;
+ }
+
+ if(self->flags & JUMPNRUN_ENEMY_EVENT_TRIGGER1) {
+ self->base.inertia.y =
+ fixed_point_add(fixed_point_add(self->base.inertia.y,
+ fixed_point_div(self->type->spawn_inertia.y, FIXED_INT(3))),
+ fixed_point_mul(FIXED_POINT(0, 5),
+ fixed_point_sub(self->spawn_pos.y,
+ enemy_position(self).y)));
+ } else {
+ self->base.inertia.y = FIXED_INT(0);
+ }
+
+ vec2d new_pos = vec2d_add(enemy_position(self), self->base.inertia);;
+ self->type->collision_tiles(self, &new_pos, lv, visible_tiles);
+ self->type->collision_player(self, state, player_inertia_mod);
+ rectangle_move_to(&self->base.current_box, new_pos);
+
+ enemy_animation_advance(self);
+}
+