Skip to content

Instantly share code, notes, and snippets.

@kuzemkon
Created December 1, 2014 11:05
Show Gist options
  • Select an option

  • Save kuzemkon/f666b8502269667fcbb5 to your computer and use it in GitHub Desktop.

Select an option

Save kuzemkon/f666b8502269667fcbb5 to your computer and use it in GitHub Desktop.
PFont font;
float a;
float b;
void setup () {
font = createFont("Consolas", 14);
textFont(font);
size(600,600);
}
void draw () {
textSize(45);
fill(255);
text("Tetris",225,60);
fill(170);
rect(50,100,500,450);
a++;
pushMatrix();
fill(255);
translate(200,100+a);
if (keyPressed == true) {
if (a>1 && a<300) {
rotate(PI/2);
}
}
zix();
popMatrix();
pushMatrix();
fill(255);
translate(400,100+b);
if (keyPressed == true) {
if (b>1 && b<300) {
rotate(PI/2);
}
}
zep();
popMatrix();
if (a+150==450) {
a=a-1;
b++;
}
if (b+100==450) {
b=b-1;
}
}
void zix() {
beginShape();
vertex(0,0);
vertex(0,100);
vertex(50,100);
vertex(50,150);
vertex(100,150);
vertex(100,50);
vertex(50,50);
vertex(50,0);
vertex(0,0);
endShape();
}
void zep() {
beginShape();
vertex(0,0);
vertex(0,50);
vertex(50,50);
vertex(50,100);
vertex(100,100);
vertex(100,50);
vertex(150,50);
vertex(150,0);
vertex(0,0);
endShape();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment