Week 4, Object Oriented Programming

Posted: September 24th, 2010 | Author: | Filed under: Assignments, Examples | 11 Comments »

This week we went over a lot, so try to look at the examples and play around with them before moving onto your assignment. I also recommend looking at Chapter 5 of the Programming interactivity book for a general overview of everything we went over in class. The section on OOP starts on page 129.


Homework Assignment

This weeks homework assignment will be similar to last week, but with a concentration on using objects. The requirements are:

-A minimum of 25 objects, which are stored in an array

-Different behaviors for the objects based on input (mouse position, mouse press/release, key presses, etc)

-All drawing of your object (ellipse(), rect(), etc, any call that directly draws to the screen) should be within your object

-All objects should not look the same, they can be similar but think about how you can use properties (variables) within the class to make them unique. Experiment with RGB, alpha, size, position, etc.


-Use fonts or images instead of drawing shapes

-Create an object that contains a number of other objects, ie: a CircleGroup class that contains man Circle objects…

Try to think about what you want to do BEFORE you start to program and think about how it would make sense logically. It may be best to work with your classmates/ask questions of each other. As usual I am always available for help through email, but please have a specific question and code that shows you have tried to make things work.

Thanks and see you in class Thursday!

11 Comments on “Week 4, Object Oriented Programming”

  1. 1 Oylum Boran said at 2:15 am on September 30th, 2010:


    I have 3 incomplete projects. I was confused and got stuck.

    First one: I am trying to make a little game in which there are randomly moving circles that I need to click on to make them disappear. When I’m finished, it should say game over and start over.

    However, I can’t figure out how to make the object understand that it is selected and disappear only that object. Right now, I cant make it, everything is disappearing.


    Second one: It is similar to the first one, my problem is the same. I need to learn how to select a particular object.


    Third one: We made a game in Bootcamp Workshop in which you have a spacecraft and shoot the circles to make them disappear. The code was written with functions only and i tried to re-write it with objects. However, it got stuck so bad because functions are related to each other with if/else s and I can’t just adopt them to oop. I hope we can figure it out in the class.


  2. 2 Minho Kim said at 7:51 am on September 30th, 2010:


  3. 3 bree said at 2:17 pm on September 30th, 2010:

    I can’t get it working exactly how I would like, but…


  4. 4 Francisco Zamorano said at 2:48 pm on September 30th, 2010:

    Good exercise, I’m understanding how objects work.
    One detail: These circles stay between posY=0 and posY=200, but they should be randomly assigned along the height. (If you take the background it seems that it works, but for some reason they stick in the upper part of the screen).


  5. 5 Lisa Lee said at 6:49 pm on September 30th, 2010:


    Move the mouse to put all balls back to the left and also change the colors of background stripes.

    Press a button to see another picture.

  6. 6 Yiruo Zhao said at 6:55 pm on September 30th, 2010:


  7. 7 Philippe Ramet said at 7:10 pm on September 30th, 2010:

    homework, squares moving, interactions with mouse and keyboard

  8. 8 Thomas Tu said at 7:19 pm on September 30th, 2010:

    press u to let the matrix stream go up;
    press any key to stop the stream;
    press “b” to call batman;
    press mouse to eject spider filmant.

  9. 9 Michelle Kirby said at 7:21 pm on September 30th, 2010:


  10. 10 Alvaro said at 7:21 pm on September 30th, 2010:


  11. 11 Seokin Jang said at 7:21 pm on September 30th, 2010:



Leave a Reply