Thursday, October 8, 2015

Day 46: Polishing Up

After finishing with the perils of collision detection, I saw that there were a couple of things that needed fixed up and optimized before putting in the concept of acceleration for the ball.

The collision impulse worked nicely for accelerating the ball in the x position, but not so necessarily in the y position. Strategically, one could smash the ball using the paddle to increase the velocity, but it never quite balanced out in the y direction. I'll be planning to ease acceleration in and out in the y direction to make sure things don't get too fast or slow.

The outline issue from yesterday gave me a bit of trouble, but I managed; the function had to redraw the line on not only the left boundary, but the upper boundary when destroying a block. When accessing the left boundary, it's as easy as going one byte back in the destroyed states array, but as for the upper boundary... oddly enough, the array goes from bottom to top, so I had to add the amount of blocks in a row instead of subtract backwards in bytes.

The last part today was a neat optimization on my lengthy branching of values when determining which value to place in each section of the address in the score display. Luckily enough, the numbers I was using to represent the display could be indexes in an array of numbers. Lo and behold, the numbers can be used to offset from the beginning of the array address to access the necessary hexadecimal value. This is a small optimization, seeing that a block isn't destroyed and score added every frame, but it's MUCH quicker than the previous implementation.



What next? There's still some polish to be done. Once the acceleration's in, the assignment will be presentable, but I'd be silly to stop there.

No comments:

Post a Comment