int timeSteps=0; scrollBar genomeScroll; PFont uiFont; boolean displayUI=true; boolean displayNeuronUI=false; boolean displayGenomeUI=true; boolean useSmooth=false; int displayMode=2; position vpos; position vposT; boolean dragCreature=false; boolean stimulateNeuron=false; boolean useGravity=false; boolean useMirror=true; cell selected=null; int selectedID=0; position genomeAnchor; float FRICTION_FORCE=0.95; float FLUID_FORCE=.2; vector GRAVITY_VECTOR=new vector(270,.1); position lightSource=new position(mouseX,mouseY); position spawnPos=new position(250,350); creature c; creature currentCreature; void setup() { useRK=true; size(500,500); uiFont=loadFont("KnockoutHTF30JuniorWelterwt-48.vlw"); textFont(uiFont); textMode(CORNER); ellipseMode(CENTER); rectMode(CORNER); vpos=new position(0,0); vposT=new position(0,0); genomeAnchor=new position(25,50); position scrollPos=new position(genomeAnchor.x,genomeAnchor.y-15); genomeScroll=new scrollBar(scrollPos,400); c=new creature(spawnPos); currentCreature=c; lightSource=new position(width/2,-4000); } void draw() { timeSteps++; if(displayUI) doUI(c); else { background(0); stroke(70); noFill(); rect(10,50,480,400); noStroke(); fill(160); textFont(uiFont,16); text("press 'h' for interface",15,470); text("press 'c' to create new creature",15,490); } if(!currentCreature.checkStability()) { c=new creature(spawnPos); currentCreature=c; } currentCreature.update(lightSource); // if(keyPressed) // doViewport(); cameraFollow(currentCreature); vposT=vposT.displace(getHeading(vposT,vpos),dist(vposT,vpos)/5); push(); translate(vposT.x,vposT.y); if(!displayUI) drawGrid(); noFill(); stroke(255,150); ellipse(lightSource,50); noStroke(); fill(255,20); ellipse(spawnPos,70); display(currentCreature); displayCreatureData(currentCreature); pop(); } void mousePressed() { } void cameraFollow(creature c) { vpos=new position(width/2-c.p.x,height/2-c.p.y+50); } void drawGrid() { stroke(30); for(int x=-1000;x<1000;x+=20) { line(x,-1000,x,1000); } for(int y=-1000;y<1000;y+=20) { stroke(30,30,50*(y+1000)/1000); line(-1000,y,1000,y); } } void doViewport() { if(key=='w') { vpos=vpos.displace(270,5); } if(key=='a') { vpos=vpos.displace(0,5); } if(key=='s') { vpos=vpos.displace(90,5); } if(key=='d') { vpos=vpos.displace(180,5); } } /*void playMode() { if(rawr!=null&&rawr.nodes!=null) { if(selected==null) selected=rawr.nodes[0]; position mp=new position(mouseX,mouseY); for(int i=0;i