Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created November 26, 2012 20:04
Show Gist options
  • Save chrisallick/4150288 to your computer and use it in GitHub Desktop.
Save chrisallick/4150288 to your computer and use it in GitHub Desktop.
class Location {
//float x, y, z;
PVector v;
float aa, ab, va, vb;
float r;
int c = 0;
boolean alive = true;
Location (float myX, float myY, float myZ, float aA, float aB, int index) {
v = new PVector( myX, myY, myZ );
// x = myX;
// y = myY;
// z = myZ;
aa = aA;
ab = aB;
va = random(-.016, .016);
vb = random(-.016, .016);
r = random(1.3,2);
}
void update() {
ab += vb;
v.y = radius*sin(aa)*sin(ab);
v.x = radius*sin(aa)*cos(ab);
v.z = radius*cos(aa);
}
void getLocation() {
return;
}
void test( int mx, int my ) {
if( alive ) {
if( mx >= screenX(v.x,v.y,v.z)-(r*4) && mx <= screenX(v.x,v.y,v.z)+(r*4) ) {
if( my >= screenY(v.x,v.y,v.z)-(r*4) && my <= screenY(v.x,v.y,v.z)+(r*4) ) {
if( screenZ(v.x,v.y,v.z) < .77 ) {
alive = false;
c = 255;
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment