Pilzverhalten: Läuft unter Spieler hin und her.
authorWintermute <wintermute@hannover.ccc.de>
Sat, 19 Oct 2013 12:13:51 +0000 (14:13 +0200)
committerWintermute <wintermute@hannover.ccc.de>
Sat, 19 Oct 2013 12:13:51 +0000 (14:13 +0200)
badge/jumpnrun/enemies.c

index cc72db3..914d342 100644 (file)
@@ -280,13 +280,12 @@ void enemy_tick_straight_follow(jumpnrun_enemy            *self,
   self->type->collision_player(self, state, player_inertia_mod);
   rectangle_move_to(&self->base.current_box, new_pos);
 
-  if(fixed_point_le(rectangle_mid_x(&state->player.current_box), rectangle_mid_x(enemy_box(self)))) {
+  if(fixed_point_lt(rectangle_right(&state->player.current_box), rectangle_left(enemy_box(self)))) {
     self->base.inertia.x = self->type->spawn_inertia.x;
-  } else {
+  } else if(fixed_point_gt(rectangle_left(&state->player.current_box), rectangle_right(enemy_box(self)))) {
     self->base.inertia.x = fixed_point_neg(self->type->spawn_inertia.x);
   }
 
-
   enemy_animation_advance(self);
 }
 
This page took 0.025696 seconds and 4 git commands to generate.