Difference between revisions of "A Moving Circle"

From CodeStuff
Jump to: navigation, search
 
Line 1: Line 1:
<edcode>
+
Key codes to know for this lesson
var x = 20;
+
 
 +
* 32 - The Space bar
 +
* 37 - Left Arrow
 +
* 38 - Up Arrow
 +
* 39 - Right Arrow
 +
* 40 - Down Arrow
 +
 
 +
<edcode>var x = 20;
 
var y = 20;
 
var y = 20;
  
 
function move() {
 
function move() {
   x += 5;
+
   x += 0.5;
   y += 1;
+
   y += 0.1;
 
}
 
}
  
 
function draw() {
 
function draw() {
 +
  clear();
 
   drawCircle(x,y,5);
 
   drawCircle(x,y,5);
 
}
 
}
  
 +
run (move,draw,30);
  
move();
 
draw();
 
 
move();
 
draw();
 
 
move();
 
draw();
 
 
move();
 
draw();
 
  
 
</edcode>
 
</edcode>

Latest revision as of 23:14, 5 September 2012

Key codes to know for this lesson

  • 32 - The Space bar
  • 37 - Left Arrow
  • 38 - Up Arrow
  • 39 - Right Arrow
  • 40 - Down Arrow