Last Day: Final Project

Our final projects for this vestibule involved us creating a demo of our own.  I decided to go with a simple demo of the game Tetris.

I was inspired by the project that we’d done earlier on in class. I got to team up with Rudy and we worked out planning a project as “driver” (someone who directs the coding) and a “writer” (someone who types up the code). While we had difficulty expressing our ideas in the director position, we both enjoyed the experience.

I choose to try to build blocks that fall and stack. I want it to have a look of a tower being created with blocks falling from the top of the display. I wanted the blocks to be different colors and to fall at different times.

I knew my code to start off with needed to have a class tab within it. So to begin I pulled up my project from the Processing A2Z and the project I worked on with Rudy in class. I examined my code and thought about what I wanted to do with the display objects.  Because I wanted to display blocks falling at different times, I knew I had to build a class tab. This would hold multiple objects and control the function. This would allow the objects to fall at different times.

The first issue I ran into was the constructor not being called.

Error #1

 

</pre>
//adding class to same display to recitfy problem

Blocks oneFall;
Blocks twoFall;
Blocks threeFall;
Blocks fourFall;

void setup(){
size (600,600); // canvas size is set to a large square.
//intialzing the call
oneFall = new Blocks();
twoFall = new Blocks();
threeFall = new Blocks();
fourFall = new Blocks();

}

void draw () {

background(200,200,255);
oneFall.display();
oneFall.move();
oneFall.ascend();

}
<pre>

 

Class to go with it

</pre>
class Blocks

{ //naming class
color c; //variable for color holder
float xpos; //variable for x coordinate
float ypos; //variable for y coordinate
float diam; //variable for diameter or size
float yspeed; //variable for movement on the y axis
float xspeed; //variable for movement on the x axis

//holds the temporay vaules for the objects in the display
Blocks (color tempC, float tempXPos, float tempYPos, float tempDiam, float tempXSpeed, float tempYSpeed)
{ {

c = tempC; //temporary color
xpos = tempXPos; // temporary x position
ypos = tempYPos; //temporary y position
diam = tempDiam; // temporary diameter/size of object
xspeed = tempXSpeed; //temporary movement along the x axis
yspeed = tempYSpeed; //temporary movement along the y axis
}

}

void display() {
noStroke(); //no stroke along object
fill(c); //holds the temporary color of the object
rect(xpos, ypos, diam, diam); //creates
}
<pre>

So the issues came up because my object constructor was not being picked up by my display. The error message considered this that the object did not exist.

I redid my code from the ground up and still got the same issue. I eventually had to go online to get the answers.

Stack Over Flow

Processing Forum

Headed to Slack to get information from my classmates.

 

And of course I was saved! Thanks to Jessica, Rich, and Mo I was able to get to the problem.

I had only 5 calls used for 6 arguments.

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s