update_on_ground_flag(hit);
- if (hit.top || hit.bottom) {
- physic.set_velocity_y(0);
+ if (hit.top) {
+ if (physic.get_velocity_y() < 0) physic.set_velocity_y(0);
+ }
+ if (hit.bottom) {
+ if (physic.get_velocity_y() > 0) physic.set_velocity_y(0);
}
- if ((hit.left && dir == LEFT) || (hit.right && dir == RIGHT)) {
+ if ((hit.left && (hit.slope_normal.y == 0) && (dir == LEFT)) || (hit.right && (hit.slope_normal.y == 0) && (dir == RIGHT))) {
turn_around();
}
WalkingBadguy::activate();
}
-
-float
+
+float
WalkingBadguy::get_velocity_y() const
{
return physic.get_velocity_y();
}
-void
+void
WalkingBadguy::set_velocity_y(float vy)
{
physic.set_velocity_y(vy);
}
-
-