Hello. I have been working on trying to freeze/slow an opponent when they come in contact with one of my projectiles. However, enemies are randomly generated and I dont know how to figure out if the object hits them and how to freeze them. So far I have tried to look through similar cases, and have come up with something like this
However I am unsure exactly how the intersecting method works with the randomised generation of enemies
public void moveX(){
if((Hydra)getOneInterectingObject(Hydra.class) != null){
int Freeze = 100;
}
if (HoldTimer>0){
HoldTimer = HoldTimer-10;
}
if(HoldTimer ==0){
x= x-2;
X = getX();
setLocation(x,500);
}
}
