Quiz 2
September 30, 2009
Once everyone is on QuizStar and ready, we’ll begin.
There are 25 questions, with 20 worth 1 point each and 5 worth 2 points each for a total of 30 points.
Lab 6: Clock
September 29, 2009
What’s that sound? Oh, my alarm’s ringing… must be time for another lab!
Read more »
Repetition and Variation
September 29, 2009
Now that we know how to harness the power of classes to make objects, it’s your turn to be creative. Read more »
Seekers
September 28, 2009
Today we are going to learn how to use classes. This is a powerful abstraction that is the foundation of “object-oriented” programming.
Download seekers.pde (or pick it up from the pickup folder) and save it to your own folder. Open it. Move the mouse around. There will be a brief lecture and explanation.
Your challenge for today:
1. Create two more seekers with different sizes and velocities.
2. Have all five seekers start from different places on the screen.
3. Add the necessary variables to the Seeker class so that each seeker instance can store color information in addition to position and velocity.
4. Change the show() function of the Seeker class so that seekers actually display themselves in color.
Homework 5
September 25, 2009
Read all of HFJ Chapter 4 by Monday, September 28 before class. This homework is due by the end of the day (midnight) on Monday.
Read more »
Quiz Next Week
September 24, 2009
Second quiz: Wednesday, September 30.
Topics: Arrays, classes, objects, instance variables, methods, boolean logic
Movement Styles
September 22, 2009
In this assignment, you will create two “characters” that appear on the screen. They could be as simple as a circle and a square, or as complex as animated sprite sequences.
One character should respond to the keys WASD and the other character should respond to the arrow keys.
Each character must have a distinctive movement style. You could do something as simple as introducing some randomness into the speed or direction. You could do something as complex as giving the character inertia or making it walk with a limp.
The characters should not interact with or affect each other, but rather should display their personalities through the way they each move in response to the keyboard.
We will share these in class on Friday, September 25.
Lab 5: Movie Theater
September 22, 2009
Due to be checked on Friday, September 25. You’re going to write a MovieTheater class (and, of course, a MovieTheaterTestDrive) that creates an array of 10 Movie objects and fills the array with references to new Movie objects. (See page 60 if the preceding sentence is not completely clear to you!) Use the following class definition for Movie:
Read more »
Keyboarding
September 21, 2009
Now that we know how to use mouse input, let’s learn about how to get input from the keyboard.
With the mouse, we could check the variables mousePressed, mouseX, and mouseY in the draw function, and we could also define the event handler functions mousePressed(), mouseReleased(), mouseMoved(), and mouseDragged() in order to respond to specific mouse events.
With the keyboard, we have similar options: there are variables keyPressed, key, and keyCode, and also functions keyPressed() and keyReleased().
Pick up the KeyboardColor example from Mr. Chun’s pickup folder and test it out. Also look at Examples > Basics > Input > Keyboard Functions. As usual, feel free to experiment.
Answer the following questions in an email to Mr. Chun:
- What is the difference between a variable and a function?
- Why might we be interested in the keyboard and mouse functions when we already have pre-defined variables? Is there anything these functions can do that we can’t do with just variables inside a single draw function?
- Explain how the % operator works.
JavaBat Extra Credit
September 18, 2009
There are eleven sets of problems on JavaBat which you can do for extra credit this semester. (The Warmup-1 and Warmup-2 sets are good to get started with, but since they have solutions there’s no extra credit for solving them.)
Each completed set is worth 5 extra credit points.
Be sure to indicate in your prefs a Teacher Share for Mr. Chun to see what you’ve completed.