sprite collision controll help
hey, im trying to make something in my game so that when a user clicks a sprite it becomes in a state of 'activity' and only 1 sprite can be in it at a time. now when a sprite is in 'activity' i want it so when the mouse gets a certaint amount of distance away from the sprite it will send the sprite off in that direction.
now what ive done so far is made a collision detection for when the mouse is over the sprite & clicked which triggers a method in one of the sprites if they collide. this method checks to see if left click was released then send it off in direction of mouse. my problem is that this doesnt seem to be working, i think whats happening is that it all works untill the if left click is released, inwhich my mouse is no longer over the sprite and the sprite just sits there then when i move my mouse back over it, it flys off in the direction it should have.
anyone have an ideas? maybe i should be going about this in a tottally diffrent manner. thanks in advance.
[1012 byte] By [
pi3rc3a] at [2007-10-2 12:51:38]

heres some of my code...
//inside main class
//when mouse sprite collides with sprite
public void collided(Sprite s1,Sprite s2){
M s3 = (M) s2;
double sX = s1.getX();
double sY = s1.getX();
double s2X = s2.getX();
double s2Y = s2.getX();
double s3X = s2X - 17.5;
double s3Y = s2Y - 17.5;
double s4X = sX - 5.5;
double s4Y = sY - 5.5;
if( Math.pow(s4X - s3X,2)+Math.pow(s4Y - s3Y,2) < Math.pow(11 + 35,2)) {
ZenGame.clickable = true;
ZenGame.clickIt(s3);
}
if(s3.activated){
System.out.println("activated!");
s3.activated = true;
s3.throwThis(s2X,s2Y);
}
}
//inside the sprite class (thing i want to click)
public void throwThis(double x, double y){
while(activated){
if(!ZenGame.leftClick){
System.out.println("ok we are in this shit dog!!");
double mX = ZenGame.mX;
double mY = ZenGame.mY;
if(x < mX){
speedX = 1;
setSpeed(speedX,speedY);
activated = false;
}
if(x > mX){
speedX = -1;
setSpeed(speedX,speedY);
activated = false;
}
if(y < mY){
speedY = 1;
setSpeed(speedX,speedY);
activated = false;
}
if(y > mY){
speedY = -1;
setSpeed(speedX,speedY);
activated = false;
}
}
}
}