- Vector<float> topResponse;
- for (Vector<int> pos(cBegin); pos.x < cEnd.x; ++pos.x) {
- if (TileAt(pos).IsSolid()) {
- topResponse = Vector<float>(0, pos.y + 1 - b.Top());
- break;
- }
- }
- Vector<float> bottomResponse;
- for (Vector<int> pos(cBegin.x, cEnd.y); pos.x < cEnd.x; ++pos.x) {
- if (TileAt(pos).IsSolid()) {
- bottomResponse = Vector<float>(0, pos.y - b.Bottom());
- break;
- }
- }
- if (!IsZero(topResponse)) {
- if (IsZero(bottomResponse)) {
- e.Move(topResponse);
+ Vector<float> min;
+ Vector<float> max;
+
+ for (Vector<int> pos(cBegin); pos.y < cEnd.y; ++pos.y) {
+ for (pos.x = cBegin.x; pos.x < cEnd.x; ++pos.x) {
+ if (!TileAt(pos).IsSolid()) continue;
+ const AABB &tBounds = TileShapeAt(pos);
+ Collision coll;
+ if (!e.bounds.Intersects(tBounds, coll)) {
+ continue;