float theta; PVector head,tail; Boolean dragging; ArrayList satellites; int centreHole; void setup(){ size(633,490); satellites = new ArrayList(); tail = new PVector(); head = new PVector(); dragging = true; } void draw(){ background(0); //draw Earth pushMatrix(); translate(width/2,height/2); noStroke(); fill(100,0,255); ellipse(0,0,80,80); popMatrix(); //draw arrow if (dragging == true){ theta = atan2(head.x-tail.x,tail.y-head.y); stroke(255); line(tail.x,tail.y,head.x,head.y); pushMatrix(); translate(head.x,head.y); rotate(theta); line(0,0,10,10); line(0,0,-10,10); popMatrix(); } for (int i = satellites.size()-1; i>=0; i--) { SATELLITE OBJECT = (SATELLITE) satellites.get(i); OBJECT.move(); if (OBJECT.needsToDestroy()){ satellites.remove(i); } OBJECT.display(); OBJECT.show_trails(); } status("Frame Rate: "+str(round(frameRate))); } void mousePressed(){ tail = new PVector(mouseX,mouseY); head = new PVector(mouseX,mouseY); dragging = true; } void mouseDragged(){ head = new PVector(mouseX,mouseY); } void mouseReleased(){ head.sub(tail); head.div(40); dragging = false; satellites.add(new SATELLITE(tail,head)); }