Sunday 26 January 2020

Week 3 - Lab 3

This week's lab started with professor asking us to discuss lab 2 if anyone in the group had any doubts about which I blogged about last week. Once we were done with it we were given a bunch of options to choose from for our lab 3 challenge. After plenty of discussions our group decided to go for a moving graphic across the screen. Full Challenge:

Option I: Bouncing Graphic
Create a simple graphic in a square that is 5x5 or 7x7 pixels in size. Use the colours available in the emulator's bitmapped display. The graphic could be a ball, a happy face, a logo, an emoji, or anything else (appropriate!) that you want to use.
Encode that graphic in bytes using DCB (declare constant byte) instructions.
Write code to make the graphic bounce around the screen, reflecting off the edges when it hits. Note: for simplicity, it is OK if the object always bounces at 45-degree angles.
Make the speed keyboard-adjustable (faster/slower) and perturb the object's path once in a while.
Challenge: randomize the starting position, and make the object bounce at angles other than 45 degrees.

Rather than getting it all at once. We decided to take a step by step approach to it. So we started by one person working on the face using declare constant byte instructions and other were trying to figure out how we could get to move a pixel in one direction first, then at an angle, then figuring out the edges and how it would bounce from it, and finally moving the whole smiley face.

While there was very limited time left when we started to work on this lab. By the end of this lab we were only able to figure out the smiley face which was pretty straight forward and creatively done by our groupmate.The following dcb instructions were used by our groupmate:

dcb 00,03,03,03,03,03,00
dcb 03,02,03,03,03,02,03
dcb 03,03,03,03,03,03,03
dcb 03,03,03,03,03,03,03
dcb 03,02,03,03,03,02,03
dcb 03,03,02,02,02,03,03
dcb 00,03,03,03,03,03,00

No comments:

Post a Comment