Product: Tetris2P AI
Sprint Summary

Daily Objectives

Notes

The if statements check if a collision DOESN’T exist. So if I use the same if cases, there’s no way to tell if its a left or right collision. What’s the minimum I need to check to determine if there’s a left collision?

(aabb1.max.x > aabb2.min.x) && (aabb1.max.x < aabb2.max.x) && yCollisions

I need to make sure that aabb1.max.x lies somewhere between aabb2’s min.x and max.x. I might also need to ensure that aabb1.min.x < aabb2.min.x? Else, aabb1 might just be inside aabb2’s x boundary.
Maybe for efficiency, we can make separate functions for checking? I can add .isLeft and .isRight functions for checking collisions. The functions will assume that there already exists a collision. I just need to figure out what common assumptions you can make so I don’t have to recheck anything.

True Assumptions if collision exists:

aabb1.max.x > aabb2.min.x
aabb1.min.x < aabb2.max.x
yCollision

ifLeftCollision:

min1 < min2

ifLeftCollisionOnly:

min1 < min2 max1 < max2

ifRightCollision:

max1 > max2

ifRightCollisionOnly:

max1 > max2 min1 > min2

Assumption for all of the above: collision exists
Ok! I’ve implemented the direction collision stuff. I had a minor run in with having all the values flipped, cause y values on html5 canvas go from top to bottom.
I need to fix the actual resolution functions though, since it doesn’t handle edge cases yet for when there’s both x and y collisions.

Objectives Completed