Tip:
Highlight text to annotate it
X
Let's Play Xcode 5! Slutty Slopes of the Bug Planet 2: The Logging Nightmare (with Color)
... and since this took over 50 minutes, let's speed things up a little.
First step is to try and understand what is happening. Logging helps.
Approaching the issue from different angles to narrow it down.
Maybe this is related to the player's larger bounding box?
Okay, that did something...
Always a good idea to test more "extreme" values.
It seems the player position is offset by 1x tile height on a slope.
Logging the height (position.y) ...
Seen that? That was the fix! :)
Well, not quite ...
More logging ...
Looks like downward velocity is increasing over time.
There. Forgot to reset y velocity when walking on a slope.
Looks like bounding box is not taken into account while on a slope.
Yup. That was it.
Still getting stuck when reaching the top.
More logging!!
Stepping through the code...
... aaaand there it was. A stray -1.0 height deduction to fix some other bug that was probably a side-effect of not taking the bounding box into account in the first place.
Seems about right now ...
Hmm, falling through connected slopes. Strange.
Yay, more logging!
What is happening??
Even more logging....
Collision bits seem right. Slope code triggers. It just doesn't change player's position
More testing needed...
Analyzing data... beep.
There we go! Height check did not consider bounding box.
Oh yeah... nice and smooth...
The logs must go. We had a nice time.
What else could I do?
How about extending UIColor with a randomColor method? Just ... because!
...and they say documenting takes too long! :)
Neat and tidy.
Color is for the "Loading" label...
Reporting: Bug fixed!
Checking in da code ... or ... wait ...
One more pass with a 2x2 bounding box.
All good! Thanks for watching! Leave a comment, let me know if you liked it, if it needs commentary, should be faster/slower, anything.