- if(other.get_flags() & FLAG_SOLID) {
- if(fabsf(hit.normal.y) > .5) { // roof or ground
- physic.set_velocity_y(0);
- } else { // bumped left or right
- physic.set_velocity_x(-physic.get_velocity_x());
- }
+ if(hit.top)
+ physic.set_velocity_y(0);
+ if(hit.bottom && physic.get_velocity_y() > 0)
+ physic.set_velocity_y(0);
+ if(hit.left || hit.right)
+ physic.set_velocity_x(-physic.get_velocity_x());
+}