-
Notifications
You must be signed in to change notification settings - Fork 11
Assignment 3
For this assignment you will be given partially completed skeleton code that contains some of the logic you will need. All areas that you need to add or modify code to to complete the assignment requirements will be marked with a TODO comment and some more specific instructions. It is not necessary to add or modify code outside these sections.
Add four block objects to obj_list as walls so that the ball will appear to bounce off the sides of the screen.
Implement the draw() method for the case where self.obj_type == "ball".
Note: You will need to set a position and velocity in the init() function before you draw so that you have a position to draw the ball at, otherwise you will get NaN errors.
When the mouse is being pressed, draw an arrow from the point (INIT_X, INIT_Y) to (CUR_X, CUR_Y).
The init() function will be called when the user releases the mouse button. Modify the code there so that the ball will start with a velocity determined by how the user moves their mouse, as shown in the demo.
Implement the solve_direction() function and modify_velocity() method so that the ball correctly responds to colliding with the walls.
The resources from the previous assignments are still applicable here, and additionally you may want to read up on classes if you are not familiar with them.