Categories

L-Train: CODE: Processing Homework

CODE: Processing Homework Creating a pattern using "for" loop   I have used "for" loop to create a pattern. It has 3 parts: The background: a gradient which changes on changing the values of mouseX (moving the mouse horizontally) A pattern of ellipses in the center A pattern...

Continue Reading

2 Train | code

int num = 50; float[] x1 = new float[num]; float[] y1 = new float[num]; float[] x2= new float[num]; float[] y2 = new float[num]; float[] x3 = new float[num]; float[] y3 = new float[num]; void setup(){ size(640,320); noStroke(); } void draw(){ background(0); fill(255); for (int i = 0; i < num-3; i++){ x1[i] = x1[i+3]; y1[i] = y1[i+3]; x2[1] = x2[i+3]+5; y2[1] = y2[i+3]+5; x3[1]...

Continue Reading

2 Train | Text Adventure Game

I am glad that I figured it out how to use just two key input in the game and create different stages for each scene. However, the flow it is not working so well after I tried to introduce another key input. There's a text...

Continue Reading

2 Train | Interactive code for 2nd week

int num = 40; int[] x = new int[num]; int[] y= new int[num]; float range=100; void setup() { size(800, 800); noStroke(); } void draw() { background(0); translate(width/2, height/2); for(int a=10; a<mouseX+mouseY; a+=20){ rotate(5); strokeWeight(2); stroke(mouseX/10,mouseY/10,100); noFill(); rect(20, 20, a, 20); fill(255,102); for(int i=0;i<num-1; i++){ x[i]=x[i+1]; y[i]=y[i+1]; } frameRate(30); x[num-1]=mouseX+(int)random(-10,10); y[num-1]=mouseY+(int)random(-10,10); rect(200+random(-range,range),200+random(-range,range),10,10); fill(random(0,255),random(0,255),random(0,255),240); for(int k=0;k<num;k++){ rect(x[k]+random(-range,range),y[k]+random(-range,range),10,10); fill(random(0,255),random(0,255),random(0,255),240); } }   for(int a=10; a<mouseX+mouseY; a+=5){ rotate(.21); strokeWeight(2); stroke(149, 242, 250); noFill(); rect(100, 100, 80, 80); } for(int a=10; a<mouseX+mouseY; a+=2){ rotate(.5); strokeWeight(2); stroke(250, 255, 15); noFill(); rect(200, 200, 10, 80); a=a+2; }   }...

Continue Reading

M Train-Code Interactive Sketch

int x=mouseX; int y=mouseY; int speedX=6; int speedY=8; void setup(){ size(800, 600); } void draw(){ background(255); if (keyPressed==false){ x=x+speedX; y=y+speedY; if ((x>width)||(x<0)){ speedX=speedX*(-1); } if ((y>height)||(y<0)){ speedY=speedY*(-1); } noStroke(); fill(0); ellipse(x, y, 20, 20); }else{ noStroke(); fill(200); ellipse(mouseX, mouseY, 20, 20); x=mouseX; y=mouseY; } }...

Continue Reading