
PDE Download: Test04yTurtle.pde
JAVA Download: Test04yTurtle.java
Click on anar+ terms to get the documentation.
import processing.opengl.*;
import anar.*;
/*
* Example for Anar library by Guillaume LaBelle + Julien Nembrini
* http://anar.ch
*/
boolean penDown = true;
boolean cameraFollow = false;
Pts trace = new Pts();
Turtle tip;
// Param f;
// Param t;
// Param r;
void setup(){
size(screen.width,screen.height-100,OPENGL);
Anar.chy(this);
Anar.drawAxis(true);
// f = new Param(1,0,10);
// t = new Param(0.01f, -.1f,.1f);
// r = new Param(0, -.1f,.1f);
//
// Anar.sliders.add(f);
// Anar.sliders.add(t);
// Anar.sliders.add(r);
tip = new Turtle();
}
void draw(){
background(200);
// tip.rotateXZ(r);
// tip.rotateXY(t);
tip.draw();
if(cameraFollow)
tip.setCameraOnTurtle();
}
void keyPressed(){
if(key==' '){
if(tip.penState)
tip.PENUP();
else
tip.PENDOWN();
}
if(key=='j'||keyCode == LEFT)
tip.LEFT(90/5f);
if(key=='l'||keyCode == RIGHT)
tip.RIGHT(90/5f);
if(key=='i'||keyCode == UP)
tip.FORWARD(20);
if(key=='k'||keyCode == DOWN)
tip.BACK(20);
if(key=='q')
cameraFollow = cameraFollow ? false:true;
}

|