The quiz will be available during the first few minutes of lab, which you will complete individually. Your lab TA will open the quiz and tell you the password you will need to get into the quiz for your section. For convenience, please click on your lab section below to access your quiz:
Section 10 am - https://forms.gle/yvNZaBpTRUVCm16X9
Section 11 am - https://forms.gle/vGXszVayeb7J4t8v6
Previously, we have seen how to animate motion of a beach ball and have it bounce against the edges of the screen and against a brick wall. For details on this, see the slides from class on 10/16.
This lab will show you another way to handle when an object goes off the screen during animation, which you may want to use for Assignment 6.
For this lab, complete the following program to implement animation motion and screen wrap-around for both the turtle and the seagull. The seagull moves by means of the arrow keys in all 4 directions, while the turtle only moves vertically (up/down) based on the buttons on the CPX that the user presses.
Starter code is given to you at the link below. The places in the code where there is a comment along with three dots like this: // ... indicate to you where you need to add one or more lines of code to make the app functional. The steps needed are also described below.
Open this link: https://studio.code.org/projects/applab/Lgp3GJGdIIjX2e-mQP_3IXey4k5uAvV_FXPM__ugJR8.
Click View Code and select the Remix button that appears near the top-left. Rename the app with a meaningful name that you will remember and include your name at the top of your code.
Complete the function updatePositions(). Do this by retrieving the seagull position values and storing them into seagullX, seagullY. Then use the values of seagullDeltaX and seagullDeltaY to properly update seagullX and seagullY and set the position of the seagull to the new values for seagullX and seagullY.
Just below onBoardEvent(buttonL, "down", function(event)) create a similar version to handle the right button. When the right button on the CPX is pressed, the turtle should move down on the screen.
(Extra Credit) In the function handleScreenWraparound(object) the code is given to handle the horizontal screen wrap-around. Add the code to implement the vertical screen wrap-around.
Remember you need to run your program within the Google Chrome browser for this to work, and that you may need to Enable the Maker Toolkit within your app.
Once you are done, copy the link to your app from the Maker App. Turn this in on Gradescope, under "Lab 10: Animation: Screen Wrap-Around."
This lab must be completed by 11:59pm on Tuesday, October 29, 2024. No late submissions will be accepted.
1 point: The function updatePostitions() has been completed and the seagull moves properly in all directions by means of the arrow keys.
1 point: An onBoardEvent() has been created to handle the right button. When the right button on the CPX is pressed, the turtle moves down on the screen.
Extra credit (1 point): The function handleScreenWraparound(object) has been completed and the vertical screen wrap-around works properly. When either the seagull or turtle moves off the screen in any direction, it reappears on the opposite edge of the screen.