IB Computer Science 1
From WLCS
Wednesday (11/7/18)
Agenda:
- Demo Part 2 activity in Mouse Variables & Functions
- Demo Fancy Buttons Assignment
- Complete Bouncing Ball
- Basic Pool: Part 1
- Make the background green
- Create a ball on the screen with dx and dy both set to random(-10,10) so that it begins moving in a random direction
- As soon as the mouse button is pressed, make the ball stop where it is
- While the mouse button is being held down, you should draw a red line from the middle of the ball to the mouse pointer
- Releasing the mouse changes the ball's velocity (dx, dy) using the difference between (x, y) and (mouseX, mouseY). i.e. the larger the green line, the faster the ball should move
- As the ball moves around the screen, it should properly bounce off the edges
- Challenges:
- Play around with stroke weight and color
- Add friction (you'll need to create new variables) to slow down the ball
- Add another ball and detect their collision (we will do this in the future)
Friday (11/2/18)
Agenda:
- Misc Quiz on Canvas
- More advanced mouse fun
- Complete the table found in Mouse Variables & Functions
- Complete the Part 2 activity in Mouse Variables & Functions
- Fancy Buttons Assignment
- Create 4 buttons on the screen of some color of your choice (use the same color for all 4 buttons)
- Hovering over a button changes its color shade darker and increases the stroke weight around that particular button
- Pressing the button makes the color shade even darker (darker than hover)
- Releasing the button should return it to its original color. Depending on how you create your program, you may not need to define mouseReleased()
- Complete Bouncing Ball
- We will combine our new mouse knowledge with the bouncing ball lab to create a simple pool program that uses the mouse to control hitting a ball to hit another ball
- Create a ball on the screen
- When the mouse is clicked, you should draw a green line from the middle of the ball to the mouse pointer
- Releasing the mouse changes the ball's velocity (dx, dy) using the difference between (x, y) and (mouseX, mouseY)