Difference between revisions of "IB Computer Science 1"

From WLCS
Line 1: Line 1:
 
== Wednesday (11/7/18) ==
 
== Wednesday (11/7/18) ==
 
'''Agenda:'''
 
'''Agenda:'''
* Demo Part 2 activity in [https://docs.google.com/document/d/1wfVoej_7PVHquaAcugEr5YWZIzbKPNl8YYKlp7Gfouo/edit?usp=sharing Mouse Variables & Functions]
+
* Mr. Bui is out b/c his son is sick. Be prepared to demonstrate all programs on Friday (11/9/18)
* Demo Fancy Buttons Assignment
+
** Part 2 activity in [https://docs.google.com/document/d/1wfVoej_7PVHquaAcugEr5YWZIzbKPNl8YYKlp7Gfouo/edit?usp=sharing Mouse Variables & Functions]
* Complete [https://docs.google.com/document/d/1xRSA_Ti8l5002jcAftcUtCTdujCojghzoTpUZwJvHQ4/edit?usp=sharing Bouncing Ball]
+
** Fancy Buttons Assignment
* Basic Pool: Part 1
+
** Complete [https://docs.google.com/document/d/1xRSA_Ti8l5002jcAftcUtCTdujCojghzoTpUZwJvHQ4/edit?usp=sharing Bouncing Ball]
 +
* Complete Basic Pool: Part 1
 
*# Make the background green
 
*# 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
 
*# 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
 
*# 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
+
*# While the mouse button is being held down, 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
+
*# Releasing the mouse changes the ball's velocity (dx and dy variables) using the differences 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
 
*# As the ball moves around the screen, it should properly bounce off the edges
 +
*# Add a second ball on the screen that is not moving, but randomly located. You can generate random numbers using [https://py.processing.org/reference/random.html random(low, high)].
 +
*# To detect if the two balls ever collide, check the distance between their centers (x1, y1) and (x2, y2).  If the distance is less than the sum  of their two radii (r1 + r1), then there is a collision.  Add a collision checking if-statement that changes the fill color of the balls if they ever collide.
 
*# Challenges:  
 
*# Challenges:  
 
*#* Play around with stroke weight and color
 
*#* Play around with stroke weight and color

Revision as of 06:37, 7 November 2018

Wednesday (11/7/18)

Agenda:

  • Mr. Bui is out b/c his son is sick. Be prepared to demonstrate all programs on Friday (11/9/18)
  • Complete Basic Pool: Part 1
    1. Make the background green
    2. 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
    3. As soon as the mouse button is pressed, make the ball stop where it is
    4. While the mouse button is being held down, draw a red line from the middle of the ball to the mouse pointer
    5. Releasing the mouse changes the ball's velocity (dx and dy variables) using the differences between (x, y) and (mouseX, mouseY). i.e. the larger the green line, the faster the ball should move
    6. As the ball moves around the screen, it should properly bounce off the edges
    7. Add a second ball on the screen that is not moving, but randomly located. You can generate random numbers using random(low, high).
    8. To detect if the two balls ever collide, check the distance between their centers (x1, y1) and (x2, y2). If the distance is less than the sum of their two radii (r1 + r1), then there is a collision. Add a collision checking if-statement that changes the fill color of the balls if they ever collide.
    9. 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
  • Fancy Buttons Assignment
    1. Create 4 buttons on the screen of some color of your choice (use the same color for all 4 buttons)
    2. Hovering over a button changes its color shade darker and increases the stroke weight around that particular button
    3. Pressing the button makes the color shade even darker (darker than hover)
    4. 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
    1. Create a ball on the screen
    2. When the mouse is clicked, you should draw a green line from the middle of the ball to the mouse pointer
    3. Releasing the mouse changes the ball's velocity (dx, dy) using the difference between (x, y) and (mouseX, mouseY)

Archives