Synthesis Day and Sketch

 

Synth Day

To be honest, this wasn’t too much of a struggle for me. Or the only moments in which there was a struggle was the debugging… I guess that’s always the case though. I didn’t have trouble conceptually. It was pretty rudimentary to understand that you’re replacing a variable with a sensor value and that sensor is going to have an effect on your sketch. What was difficult, and what I would like to understand a bit more of, is what exactly is happening in all of that code that we virtually copy and paste on synthesis day. That aside, the day was enjoyable for the sheer amount of possibilities it opened up including for the baseball sketch I can’t seem to get away from.

In terms of that sketch, my partner Swapna and I thought it would be cool to “become” the pitcher in my baseball sketch. Rather than have the ball automatically redraw itself once it left the frame, it would be cool to determine via the press of a button when the baseball would be thrown. Adding that definitely makes the sketch more of a game just a really…boring one. However it’s a start. Perhaps now I can introduce four different buttons each corresponding to a different pitch; button one is a fastball, button two a curve etc. My P-Comp – and hopefully ICM – midterm is going to revolve around a lot of this stuff. DO YOU KNOW ANYONE AT MLB, DANO?!

SKETCH

 

I admit: I am having some problems again with ICM. It’s sort of like , you said in class, the plateau is gone and the hill is in the midst of being climbed. Once again, I understand the concepts. I know what a constructor function is and how they work logically. However, I am having a lot of difficulty applying the concept to a sketch from scratch. For my sketch this week, I took some code that was in the Coding Rainbow video and made it my own a bit which is fine. I understand that’s a viable way to learn. But what I’d love to do, and what I am still trying to work on is making this from the get-go. If I don’t understand a bit better by end of week, I see some office hours in our future. NO SPORTS TALK ALLOWED.

 

CODE:

var bubbles = [];

function preload () {
img = loadImage(“Coaster.jpg”);
}

function setup() {
createCanvas(600, 400);
img.loadPixels();
for (var i = 0; i < 20; i++) {
bubbles[i] = new Bubble();
}
}

function mouseDragged () {
bubbles.push(new Bubble(mouseX, mouseY));
}

function draw() {
background(255);
image(img,0,0,600,400);
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].move();
bubbles[i].display();
}

if (bubbles.length > 10) {
bubbles.splice(0,1);
}
}
function Bubble(x,y) {
this.x = x;
this.y = y;

this.display = function() {
stroke(255);
fill(0);
rect(this.x,this.y-24, 25,25);
stroke(10);
strokeWeight(2);
fill(255);
ellipse(this.x+24,this.y,12,12);
ellipse(this.x, this.y, 12, 12);

};

this.move = function() {
this.x = this.x + random(-0.5, 0.5);
this.y = this.y + random(-0.5, 0.5);

};
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *