- Watch Mary Rose Cook Live Codes Space Invaders from Front-Trends. (The second worst conference name ever?)
This was so fun to watch!
- What is one approach you can take from Mary's code and implement in your project?
Space Invaders is very different from what Beth and I are building, however I think the concept of the 5 checks for collison detection are invaluable and can be applied in all sorts of scenarios. These 5 checks tell us that 2 objects are NOT colliding if:
- object1 is the same as object2
- the right-most side of object1 is to the left of the left-most side of object2
- the left-most side of object1 is to the right of the right-most side of object2
- the top side of object1 is below the bottom side of object2
- the bottom side of object1 is above the top side of object2
Beth and I could potentially implement our checks for a winning pattern by using similar logic. We opted instead to determine a winning puzzle by matching the orientation of each piece to it's "winningOrientation" (a property we set on the object at it's creation). But I feel like I will use the logic of collision detection in the future and I think it's super cool to know (I thought collision detection sounded terrifyingly complicated and was sure I wouldn't understand it. It was nice to have it laid out in such an understandable way).
I also really liked the way Mary created the tick
funciton that instructs the game to update and draw itself. Beth and I may be too far down our own path now, but we sort of have a set up like this and, as we refactor, it seems our lay out is getting closer to this concept. I think ;)