topical media & game development
graphic-processing-algorithm-Ch06-p140-p140.pde / pde
MyElement e = new MyElement(); //define an element
void setup(){
e.xspeed = random(1);
e.yspeed = random(1);
}
void draw(){
background(200);
e.move(); //draws the element
}
void mouseDragged(){
if(dist(mouseX,mouseY,e.xpos,e.ypos)<20){
e.friction = .5;
e.xspeed = mouseX-pmouseX;
e.yspeed = mouseY-pmouseY;
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.