Monday, October 5, 2015

Day 43: Random Color Eater

As the second prototype draws to a close, I found more time to focus on the assembly assignment. I had figured out the distortion bug that was plaguing my ball drawing - seems as if I had forgotten to present the scene once it had drawn as a double buffer. Afterwards, I also realized every draw called could add up to a single scene present command, which saved a few lines.

Next up was block population and collision. Since the project called for a bit of randomness, I decided to make every block a random color. The actual creation of a random number generator is slightly horrific to think of in an assembly perspective, so I opted for the approach used in class, or combining the get-time command (gets time in hundredths of a second since midnight) and the number of clock cycles at that time. Do some multiplications and additions with a seed value and one ends up with random colors.

Another thing that I managed was collision detection and ball movement, which led to a particularly strange bug (well, the blocks are a completely different type of collision detection than the walls, so they still need done) in which the ball moved much more slowly when the paddle was moving at the same time. This led to a horrific discovery; the bitmap chunks determine the flow of time in this game, so that in order for a constant speed throughout the bitmaps needed to be constantly drawn, instead of only drawing while moving. This led to a more complete looking scene here:


As one can see, the collision with blocks and the paddle is most certainly next on the list.

No comments:

Post a Comment