base.y + base.height))
{
if (dir == LEFT)
+ {
dir = RIGHT;
+ physic.set_velocity_x(fabs(physic.get_velocity_x()));
+ }
else
+ {
dir = LEFT;
-
- physic.set_velocity_x(fabs(physic.get_velocity_x()) * dir == LEFT ? -1 : 1);
+ physic.set_velocity_x(-fabs(physic.get_velocity_x()));
+ }
}
}
}
if (base.y + base.height < pbad_c->base.y + pbad_c->base.height)
{
if (pbad_c->dir == LEFT)
+ {
dir = RIGHT;
+ physic.set_velocity(fabs(physic.get_velocity_x()), 2);
+ }
else if (pbad_c->dir == RIGHT)
+ {
dir = LEFT;
+ physic.set_velocity(-fabs(physic.get_velocity_x()), 2);
+ }
+
- physic.set_velocity(fabs(physic.get_velocity_x()) * dir == LEFT ? -1 : 1, 2);
break;
}
if (pbad_c->kind != BAD_FLAME)
{
- if (dir == LEFT)
- dir = RIGHT;
- else if (dir == RIGHT)
- dir = LEFT;
-
- physic.set_velocity_x(fabs(physic.get_velocity_x()) * dir == LEFT ? -1 : 1);
+ if (dir == LEFT)
+ {
+ dir = RIGHT;
+ physic.set_velocity_x(fabs(physic.get_velocity_x()));
+ }
+ else if (dir == RIGHT)
+ {
+ dir = LEFT;
+ physic.set_velocity_x(-fabs(physic.get_velocity_x()));
+ }
+
}
}