Difference between revisions of "Radish"

From CodeStuff
Jump to: navigation, search
Line 22: Line 22:
  
 
var tx=10;
 
var tx=10;
 +
var dx=1;
 
var test = loadImage("/images/radish.png");
 
var test = loadImage("/images/radish.png");
  
 +
function move() {
 +
  tx+=dx;
 +
  if (tx>600) dx=-1;
 +
  if (tx<30) dx=1;
 +
}
  
function frame() {
+
function draw() {
 
   clear();
 
   clear();
 
+
   setColour("Black");
   setColour("#00f");
+
  fillCircle(tx,80,30);
+
 
   drawImage(test,tx,100)
 
   drawImage(test,tx,100)
  tx+=0.1;
 
 
  flush(true); 
 
  setTimeout(frame,20);
 
 
}
 
}
  
frame();
+
run(move,draw);
 +
 
  
 
</edcode>
 
</edcode>

Revision as of 09:12, 23 January 2012

Testing Image use.

Should also have some animation.

Animation is shaky because there is currently no feedback from the rendering thread to say how fast things are being drawn.