Week 3

Reflection:

I was very frustrated with trouble shooting this hoemwork. I kept getting an error expected Rcurly found ‘*’ and it highlighted a closing curly bracket. It also will not let me export the sketch. I have tried re-writting it 3 different ways. Does anyone have any ideas. The code and sudeo code is below.

 

Sudeo:

//What I want:
//Spots that fall when you hold and click
//background will be circles
//overlay will be lines random within blue color spectrum
//
//
//code suto
//
//I need array of circles (class)
//I need array of lines that overlay circles (class)
//I need circles that move when you push a key or click and hold down
//
//
//1) declare global varibles
//2) void setup
//- this should have the background
//- size of sketch
//- construct the object
//
//
//3) void draw
//background color
//- display sp the object
//- display class
//
//4) class (name of class) (new tab)
//
//
//5)class (name of class) (new tab)
//*** questions — so if you have a class how do you display it again?

 

Main File: 

line1 [] firstLine;
line1 [] secondLine;
line1 [] thirdLine;
line1 [] fourthLine;
line1 [] fifthLine;
void setup () {
size (600, 600);
smooth ();
noStroke ();

int numSets = width; // what is this dooing width of array?
firstLine = new line1[numSets];
for (int i=0;i<numSets;i++) {
firstLine[i] = new line1(i * 10, 50, 0.01);
}
}

void draw () {
background (0);
for (int i=0; i <width; i++) {
firstLine [i].display();
}
}

 

Class File for Line: 

 
//** why do i want to float as apposed to giving a direct number

//Delcare : Name the class
class line1 {
float x;
float y;
color lc;
//
line1(float xPos, float YPos, float xPos, float YPos){
x = xPos;
y = Ypos;
}
}
void display() { //functions
line(x, 0, 600, 0);
stroke (random);
}
}