长相思丶在风中 长相思丶在风中
关注数: 0 粉丝数: 64 发帖数: 633 关注贴吧数: 40
processing图像怎么换行? int x1=70; int x2=72; int x3=53; int x4=81; int y1=10, y2=17, y3=36, y4=32, y5=20, y6=25, y7=7, y8=2; int m = 0, m1 = 0; boolean dooropen= true; boolean goingRight = true; boolean goingLeft = true; boolean fall=true; int a =0; boolean get3Points = false; boolean LostLife = false; boolean get1Point = false; void setup() { size(512, 348); noStroke(); frameRate(8); } void draw() { background(210); //door open float f = random(24, 64); a++; if (dooropen) { stroke(0); //right door line(412, 211, 412, 308); noFill(); rect(420, 208, 52, 86); fill(0); //right door window and door handle rect(439, 228, 15, 15); ellipse(430, 257, 5, 5); } if (!dooropen) { stroke(0); line(412, 211, 412, 308); noFill(); rect(420, 208, 52, 86); quad(497, 199, 472, 208, 472, 294, 497, 315); fill(0); quad(477, 227, 477, 240, 488, 244, 488, 220); } if (a>=f) { dooropen=!dooropen; a=0; } //falling tool quad(181, y1, 172, y2, 187, y3, 196, y4); quad(186, y5, 191, y6, 215, y7, 210, y8); if (fall&y3<height+13) { y1+=13; y2+=13; y3+=13; y4+=13; y5+=13; y6+=13; y7+=13; y8+=13; } else if (y3==height+13) { y1=10; y2=17; y3=36; y4=32; y5=20; y6=25; y7=7; y8=2; get1Point = true; m1=m1+1; } fill(0); // Mr.GW noStroke(); ellipse(x1, 242, 35, 35); triangle(x2, 255, x1, 295, x3, 282); fill(210); ellipse(x4, 250, 15, 10); //move MR.GW if (keyPressed && (key == CODED)&dooropen) { if (keyCode == RIGHT&& goingRight) { x1+=63; x2+=63; x3+=63; x4+=63; } else if (keyCode == LEFT&& goingLeft) { x1-=63; x2-=63; x3-=63; x4-=63; } } if (goingLeft && x1<133 ) { goingLeft = false; } else if (!goingLeft &&x1==133) { goingLeft = true; } else if (goingRight && (width-x1<127)) { goingRight = false; } else if (!goingRight && (width-x1==127)) { goingRight = true; } if (keyPressed && (key == CODED)&!dooropen) { if (keyCode == RIGHT&& goingRight) { x1+=63; x2+=63; x3+=63; x4+=63; } else if (keyCode == LEFT&& goingLeft) { x1-=63; x2-=63; x3-=63; x4-=63; } } if (goingLeft && x1<133 ) { goingLeft = false; } else if (!goingLeft &&x1==133) { goingLeft = true; } else if (goingRight && (width-x1<190)) { goingRight = false; } else if (!goingRight && (width-x1==190)) { goingRight = true; } //resets Mr.GW if (dist(187, y3, x1, 242)<=20) { x1=70; x2=72; x3=53; x4=81; LostLife=true; } if (x1==448) { x1=x1-378; x2=x2-378; x3=x3-378; x4=x4-378; goingRight = true; get3Points = true; m=m+3; } if (get1Point) { int i2= 42; for (int i=0; i< m1; i++) { for (int d = 84; d>0; d-=10) { fill(d); ellipse(42+i*84, i2, d, d); } } } if (get3Points) { fill(0); int i2= 42; for (int i=0; i< m; i++) { for (int d = 84; d>0; d-=10) { fill(d); ellipse(42+i*84, i2, d, d); } } while (m == 6) { i2=i2+84; m = 0; } } if (LostLife) { for (int i=0; i<6; i++) { for (int d = 84; d>0; d-=10) { fill(255, d, d); ellipse(42+i*84, 42, d, d); } } } } 这是我写的代码,要求是锤子落地得1分,人物进了门得3分重置位置,被锤子砸中重置位置并且最上面一排变成红色,我不知道怎么弄能在第一行的圆圈满了之后换到第二行去啊!!!求大神赐教!!!而且要求被锤子砸中之后之前得的分不会消失,被顶到下一行去,就是第一行变成红色,然后屏幕全部被填满了之后,重置整个游戏,所有圆圈消失。
首页 1 2 下一页