Difference between revisions of "Radish"

From CodeStuff
Jump to: navigation, search
(Changed to use wiki local image)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
Testing Image use. 
 +
 +
Should also have some animation. 
 +
 +
Seems to suck a huge deal more CPU on Firefox than Chrome.
 +
Timing still not 100% but at least better than it was.
 +
 +
Event IO now working.  Keyboard and Mouse.  (move the radish up and down)
 +
 
<edcode>
 
<edcode>
 
print("wibble");
 
print("wibble");
Line 15: Line 24:
 
makeBackground();
 
makeBackground();
  
 +
var ty=100;
 
var tx=10;
 
var tx=10;
var test = loadImage("/images/radish.png");
+
var dx=1;
 +
var test = loadImage("radish.png");
  
 +
function move() {
 +
  tx+=dx;
 +
  if (tx>600) dx=-1;
 +
  if (tx<30) dx=1;
 +
  if (keyIsDown(38)) ty-=3;
 +
  if (keyIsDown(40)) ty+=3;
  
function frame() {
 
  clear();
 
  setColour("Black");
 
  print("Pluble",30,20);
 
  drawLine(0,0,320,240);
 
  fillCircle(tx,80,30);
 
  drawImage(test,tx,100)
 
  tx+=0.1;
 
  print(JSON.stringify(test),30,30);
 
 
  postFunctionCall("batch",{value:true});
 
  setTimeout(frame,20);
 
  
 
}
 
}
  
frame();
+
function draw() {
 
+
  clear();
 +
  setColour("Black");
 +
  drawImage(test,tx,ty)
 +
    print(JSON.stringify(getMousePosition()),30,200);  
 +
}
  
 +
run(move,draw);
 
</edcode>
 
</edcode>

Latest revision as of 06:44, 26 January 2012

Testing Image use.

Should also have some animation.

Seems to suck a huge deal more CPU on Firefox than Chrome. Timing still not 100% but at least better than it was.

Event IO now working. Keyboard and Mouse. (move the radish up and down)