User Tools

Site Tools


hong_kong_students_click_here

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hong_kong_students_click_here [2015/07/23 11:32]
ffpaladin
hong_kong_students_click_here [2015/07/23 14:50]
ffpaladin
Line 284: Line 284:
  
 int counter; int counter;
-int x = 20;+int x = 0; 
 +int y = 0; 
 int dx = 5; int dx = 5;
-int y = 20; 
 int dy = 2; int dy = 2;
  
Line 295: Line 296:
 void draw() {  //draw function loops  void draw() {  //draw function loops 
   ​   ​
-  ​ellipse(x,y,20,20);+  ​background(0);
   ​   ​
-  x = x + dx; +  ​ellipse(x,y,20,20)
-  y = + dy+ 
-  +  if (x > 500) {
-  if (x > 250) {+
     dx = dx * -1;     dx = dx * -1;
   }   }
-  ​+
   if (x < 0) {   if (x < 0) {
     dx = dx * -1;     dx = dx * -1;
   }   }
-  ​ + 
-  if (y > 250) {+  if (y > 500) {
     dy = dy * -1;     dy = dy * -1;
   }   }
-  ​+
   if (y < 0) {   if (y < 0) {
     dy = dy * -1;     dy = dy * -1;
   }   }
   ​   ​
 +  x = x + dx;
 +  y = y + dy
 +  ​
 +  if (mousePressed) {
 +   x = mouseX;
 +   y = mouseY;
 + }
 } }
- 
 </​code>​ </​code>​
/soe/sherol/.html/teaching/data/pages/hong_kong_students_click_here.txt · Last modified: 2015/07/23 14:50 by ffpaladin