fnugget
YaBB Newbies
Offline
Posts: 1
Re: Problems with displaying executable jar file
Reply #12 - Jun 2nd , 2007, 5:12am
I can't find out this one. No extra libraries, no files, and I still get a grey box. Mac OS X 10.4.9, java 1.4.2 it's a "blob" that follows the mouse. click to drop food, which makes the blob larger if it runs over it. CODE: /** *Come on, work will ya? */ int i, siz = 600, num = 0, r = 10; boolean FLAG; float theta0 = 0, theta, x = width/2, y = height/2; food f[] = new food[10]; void setup() { size(siz,siz); background(0); smooth(); noStroke(); randomSeed(second()); PFont fontA = loadFont("Ziggurat-HTF-Black-32.vlw"); textFont(fontA, 14); rectMode(CENTER); frameRate(40); } void draw() { //partial scren erase fill(0); ellipse(x,y,r+2,r+2); //turning rate + correction theta = atan2((mouseY - y),(mouseX - x)); if ((theta - theta0)>PI) theta0 = theta0 + (-TWO_PI + theta - theta0)/15; else if ((theta - theta0)<-PI) theta0 = theta0 + (TWO_PI + theta - theta0)/15; else theta0 = theta0 + (theta - theta0)/30; if (theta0 > PI) theta0 = theta0 - TWO_PI; if (theta0 < -PI) theta0 = theta0 + TWO_PI; //move x = x + (3*cos(theta0)); y = y + (3*sin(theta0)); //inputs //draw stroke(255); for( i = 0; i < num; i++) { if (f[i].hitTest(f[i].x,f[i].y,x,y)) FLAG = true; if (FLAG) { if (i < (num - 1)) { f[i] = f[i+1]; rect(f[i].x, f[i].y, 5, 5); } else { num = num - 1; r = r + 1; } } else { rect(f[i].x, f[i].y, 5, 5); } } FLAG = false; fill(255); ellipse(x,y,r,r); // line(x,y,x+15*cos(theta0),y+15*sin(theta0)); noStroke(); } void mousePressed() { if (mouseButton == LEFT) { if (num < 10) { f[num] = new food(); num = num + 1; } } else if(mouseButton == RIGHT) { fill(0); ellipse(x,y,r+2,r+2); fill(255); x = width - mouseX; y = height - mouseY; } } class food { float x, y; food() { x = mouseX; y = mouseY; } food(food f) { x = f.x; y = f.y; } boolean hitTest(float a, float b, float c, float d) { if ((sqrt(sq(c - a) + sq(d - b))) < r/2) return true; return false; } }