วันพุธที่ 17 ธันวาคม พ.ศ. 2557

ส่วนที่แก้ไขต่างๆจาก bitbucket (1)


+int numSwitch = 0;
+int menu=0;
+int turtleX = 230;
+int size = 200;
 int r1 = 300;
-int size = 200;
-int turtleX = 230;
 int posX1 = 430;
 int r2 = 200;
-int countPage=0;
-//float xVar1=-720;
-//float xVar2=1820;
-//float xVar3=-2420;
-//float xVar4=-670;
-//float xVar5=1880;
-//float xVar6=-2480;
+
 float y_var2=-20;
 float x_var2=950;
-int change_var=0;
+
+float yFlow=0;
+int y_pos_ball=170;
+int x_pos_ball=150;
+int x_roll=350;
+int g_roll=0;
+int y_fall=180;
 
 int y = 700;
 int y2 = 700;
 int y3 = 700;
+
+int y4 = 700;
 int y5 = 700;
-int y4 = 700;
-int SwitchFunction = 0;
-int SwitchArray = 0;
+int y6 = 700;
 
-//float xCon1=-520;
-//float xCon2=1620;
-//float xCon3=-2000;
-//float yCon1=-200;
-//float yCon2=1100;
-float yFlow=0;
-int y_pos_ball=120;
-int x_pos_ball=300;
-int x_roll=350;
-int g_roll=0;
-int y_fall=180;
-int change_con=-1;
-void setup() {
-  size(900, 700);
+int y7 = 700;
+
+void setup () {
+size (900, 700);
 }
-void draw() {
-  click_to_next_page ();
+void draw () {
+click_to_next_page ();
 }
 void click_to_next_page () {
-  switch (countPage) {
-  case 0:
-    Introduction();
-    break;
-  case 1:
-    mainMenu();
-    break;
-  case 2:
-    teachVar();
-    break;
-  case 3:
-    Function();
-    break;
-  case 4:
-    Array();
-    break;
-  case 5:
-    teachCondition();
-    break;
-  }
+switch (numSwitch) {
+case 0 :
+Introduction();
+break;
+case 1:
+menu = 1;
+Menu();
+break;
+
+case 2:
+menu = 0;
+Background1();
+varPage1();
+break;
+
+case 3 :
+menu = 0;
+Background1();
+varPage2();
+break;
+
+case 4 :
+menu = 0;
+Background1();
+VarExplanation();
+break;
+
+case 5 :
+menu = 0;
+Background1();
+teachIfelse();
+break;
+
+case 6 :
+menu = 0;
+Background1();
+teachLoop();
+break;
+
+case 7 :
+menu = 0;
+Background1();
+teachFlowChart();
+break;
+
+case 8 :
+menu = 0;
+Background1();
+Condition2();
+break;
+
+case 9:
+menu = 0;
+Function_1();
+break;
+
+case 10:
+menu = 0;
+Function_2();
+break;
+
+case 11:
+menu = 0;
+Function_3();
+break;
+
+case 12:
+menu = 0;
+Array_1 ();
+break;
+
+case 13:
+menu = 0;
+Array_2 ();
+break;
+
+case 14:
+menu = 0;
+Array_3 ();
+break;
+
+case 15:
+menu = 0;
+Practice_move ();
+break;
 }
-void Function () {
-  switch (SwitchFunction) {
-  case 0 :
-    Function_1();
-    break;
-
-  case 1:
-    Function_2();
-    break;
-
-  case 2:
-    Function_3();
-    break;
-  }
 }
 
-void Array () {
-  switch (SwitchArray) {
-  case 0 :
-    Array_1();
-    break;
+void mousePressed() {
+int posY1 = 650;
+int turtleY = 600;
+int x1 = 120;
+int y1 = 200;
+int x2 = 800;
+int y2 = 100;
+int posX2 = 600;
+int posY2 = 560;
 
-  case 1:
-    Array_2();
-    break;
-  }
+if (menu == 1) {
+////////////////Variable////////////////////////////////////
+if (mousePressed&&(mouseX>=x2-50 && mouseX<= width) && (mouseY >= y2-50 && mouseY <= y2+150)) {

+numSwitch = 1;
+}
+////////////////conditions////////////////////////////////////
+if (mousePressed&&(mouseX>=50 && mouseX<= x1+60) && (mouseY >= 100 && mouseY <= y1+60)) {

+numSwitch = 4;
+}
+////////////////function////////////////////////////////////
+if (mousePressed&&(mouseX>=posX2+50 && mouseX<= width) && (mouseY >= posY2-230 && mouseY <= posY2-100)) {

+numSwitch=8;
+}
+////////////////array////////////////////////////////////
+if (mousePressed&&(mouseX>=150 && mouseX<= turtleX+100) && (mouseY >= turtleY-90 && mouseY <= height)) {

+numSwitch=11;
+}
+////////////////practice////////////////////////////////////
+if (mousePressed&&(mouseX>=posX1-50 && mouseX<= width-200) && (mouseY >= posY1-20 && mouseY <= height)) {

+numSwitch=14;
+}
+}
+if (numSwitch == 15) {
+numSwitch=0;
+}
+numSwitch++;
 }
 
 void Introduction() {
-  int x=-50;
-  color c[]= {
-    #F296F7, #0DB4FF, #FFA850, #3DE858
-  };
-  noStroke();
-  background(#FFC4E3);
-  fill(random(0, 255), random(0, 255), random(0, 255));
-  ellipse(random(0, width), random(0, height), 10, 10);
-  textSize(30);
-  fill(#F55D05);
-  text("Programming Fundamentals", 245, 110);
-  fill(#368131);
-  text("By", 420, 190);
-  fill(#025CE8);
-  text("Chalita Ganjanmuang", 290, 260);
-  fill(#FA082C);
-  text("Unthika Nongbua", 320, 340);
-  textSize(15);
-  ButtonChangePage(800, 600, "Click!");
-  for (int i=0; i<c.length; i++) {
-    fill(c[i]);
-    fill(0);
-    x=x+200;
-    drawPooH(x, 480, c[i]);
-  }
+int x=-50;
+color c[]= {
+‪#‎F296F7‬, ‪#‎0DB4FF‬, ‪#‎FFA850‬, ‪#‎3DE858‬
+};
+noStroke();
+background(‪#‎FFC4E3‬);
+fill(random(0, 255), random(0, 255), random(0, 255));
+ellipse(random(0, width), random(0, height), 10, 10);
+textSize(30);
+fill(‪#‎F55D05‬);
+text("Programming Fundamentals", 245, 110);
+fill(#368131);
+text("By", 420, 190);
+fill(‪#‎025CE8‬);
+text("Chalita Ganjanmuang", 290, 260);
+fill(‪#‎FA082C‬);
+text("Unthika Nongbua", 320, 340);
+textSize(15);
+ButtonChangePage(800, 600, "Click!");
+for (int i=0; i<c.length; i++) {
+fill(c[i]);
+fill(0);
+x=x+200;
+drawPooH(x, 480, c[i]);
 }
+}
+
+void ButtonChangePage(int x, int y, String s) {
+noStroke();
+fill(‪#‎122BFC‬);
+rect(x-100, y-10, 100, 30);
+triangle(x, y-20, x, y+30, x+30, y);
+fill(255);
+text(s, x-90, y+8);
+noFill();
+}
+
 void drawPooH(int x, int y, color c) {
-  fill(c);
-  stroke(c);
-  ellipse(x-50, y-50, 50, 50); //ears
-  ellipse(x+50, y-50, 50, 50);
-  ellipse(x, y, 150, 120); //body
-  fill(0);
-  ellipse(x-30, y-5, 20, 20); //eye
-  ellipse(x+30, y-5, 20, 20);
-  stroke(0);
-  ellipse(x, y+25, 20, 20); //nose
+fill(c);
+stroke(c);
+ellipse(x-50, y-50, 50, 50); //ears
+ellipse(x+50, y-50, 50, 50);
+ellipse(x, y, 150, 120); //body
+fill(0);
+ellipse(x-30, y-5, 20, 20); //eye
+ellipse(x+30, y-5, 20, 20);
+stroke(0);
+ellipse(x, y+25, 20, 20); //nose
 }
-void ButtonChangePage(int x, int y, String s) {
-  noStroke();
-  fill(#122BFC);
-  rect(x-100, y-10, 100, 30);
-  triangle(x, y-20, x, y+30, x+30, y);
-  fill(255);
-  text(s, x-90, y+8);
-  noFill();
+
+void Menu () {
+background (153, 255, 255);
+noStroke ();
+fill (153, 255, 51);
+ellipse (width/2, height, width, height/2);
+fill (51, 0, 102);
+textSize (60);
+text ("Menu", (width/2)-70, 75);
+fill (0, 0, 255);
+textSize (40);
+text ("Click on the title", (width/2)-200, 300);
+text (" to access the lessons", (width/2)-250, 350);
+Menu_Chicken(width-300, height-140, 30);
+Menu_Move ();
 }
-void mainMenu() {
-  Menu();
-  Menu_Move();
+
+
+void Menu_Move () {
+int posY1 = 650;
+int turtleY = 600;
+int x1 = 120;
+int y1 = 200;
+int x2 = 800;
+int y2 = 100;
+int posX2 = 600;
+int posY2 = 560;
+
+Menu_Balloon(x1, y1, size);
+if ((mouseX>=50 && mouseX<= x1+60) && (mouseY >= 100 && mouseY <= y1+60)) {
+size = 210;
+} else {
+size = 200;
 }
-void Menu () {
-  background (153, 255, 255);
-  noStroke ();
-  fill (153, 255, 51);
-  ellipse (width/2, height, width, height/2);
-  fill (51, 0, 102);
-  textSize (60);
-  text ("Menu", (width/2)-70, 75);
-  fill (0, 0, 255);
-  textSize (40);
-  text ("Click on the title", (width/2)-200, 300);
-  text (" to access the lessons", (width/2)-250, 350);
-  Menu_Chicken(width-300, height-140, 30);
+
+Menu_Sun (x2, y2, r1);
+if ((mouseX>=x2-50 && mouseX<= width) && (mouseY >= y2-50 && mouseY <= y2+150)) {
+r1 = 310;
+} else {
+r1 = 300;
 }
-void Menu_Move () {
-  int posY1 = 650;
-  int turtleY = 600;
-  int x1 = 120;
-  int y1 = 200;
-  int x2 = 800;
-  int y2 = 100;
-  int posX2 = 600;
-  int posY2 = 560;
-  Menu_Balloon(x1, y1, size);
-  if ((mouseX>=50 && mouseX<= x1+60) && (mouseY >= 100 && mouseY <= y1+60)) {
-    size = 210;
-  } else {
-    size = 200;
-  }
-  Menu_Sun (x2, y2, r1);
-  if ((mouseX>=x2-50 && mouseX<= width) && (mouseY >= y2-50 && mouseY <= y2+150)) {
-    r1 = 310;
-  } else {
-    r1 = 300;
-  }
-  Menu_Turtle (turtleX, turtleY);
-  if ((mouseX>=150 && mouseX<= turtleX+100) && (mouseY >= turtleY-90 && mouseY <= height)) {

-    turtleX = 240;
-  } else {
-    Menu_Tree (50, height-200, 150);
-    turtleX = 230;
-  }
-  Menu_Pencil (posX1, posY1);
-  if ((mouseX>=posX1-50 && mouseX<= width-200) && (mouseY >= posY1-20 && mouseY <= height)) {

-    posX1 = 420;
-  } else {
-    Menu_Tree (50, height-200, 150);
-    posX1 = 430;
-  }
-  fill(51, 0, 0);
-  ellipse (posX2+150, posY2-180, r2, r2-50);
-  fill (255);
-  textSize(30);
-  text ("Functions", posX2+80, posY2-170);
-  if ((mouseX>=posX2+50 && mouseX<= width) && (mouseY >= posY2-230 && mouseY <= posY2-100)) {

-    r2 = 210;
-  } else {
-    r2 = 200;
-  }
+
+Menu_Turtle (turtleX, turtleY);
+if ((mouseX>=150 && mouseX<= turtleX+100) && (mouseY >= turtleY-90 && mouseY <= height)) {

+turtleX = 240;
+} else {
+Menu_Tree (50, height-200, 150);
+turtleX = 230;
+}
+Menu_Pencil (posX1, posY1);
+
+if ((mouseX>=posX1-50 && mouseX<= width-200) && (mouseY >= posY1-20 && mouseY <= height)) {

+posX1 = 420;
+} else {
+Menu_Tree (50, height-200, 150);
+posX1 = 430;
+}
+
+fill(51, 0, 0);
+ellipse (posX2+150, posY2-180, r2, r2-50);
+fill (255);
+textSize(30);
+text ("Functions", posX2+80, posY2-170);
+
+if ((mouseX>=posX2+50 && mouseX<= width) && (mouseY >= posY2-230 && mouseY <= posY2-100)) {
+
+} else {
+
+r2 = 200;
+}
 }
 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น