Week 4, Object Oriented Programming
Posted: September 24th, 2010 | Author: admin | 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.
Bonus
-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!
Hey,
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.
http://a.parsons.edu/~borao194/blog/files/cclab/03/oop01/
Second one: It is similar to the first one, my problem is the same. I need to learn how to select a particular object.
http://a.parsons.edu/~borao194/blog/files/cclab/03/oop02/
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.
http://a.parsons.edu/~borao194/blog/files/cclab/03/oop03_asteroids
http://a.parsons.edu/~kimm541/03/
I can’t get it working exactly how I would like, but…
http://a.parsons.edu/~rubib864/CCLab/ballsandsquares/index.html
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).
http://a.parsons.edu/~zamof709/CCLAB/HW_Week4_Francisco/applet/index.html
http://a.parsons.edu/~leei674/MFADT2010_Fall/cc_lab/0930/applet/index.html
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.
http://a.parsons.edu/~zhaoy563/CClab/week04/
homework, squares moving, interactions with mouse and keyboard
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.
http://a.parsons.edu/~kirbm818/ccLab/Hw%20wk5/applet/
http://a.parsons.edu/~sotoa363/cclab/appletstar/
Ass#3
http://a.parsons.edu/~jangs384/Seokin3/applet/
Ass#1
http://a.parsons.edu/~jangs384/Seokin2/