well hello masters of greenfoot java.
i have class Amoeba (image and an Actor).
I want my amoeba to eat another amoeba. Lets say we have
Amoeba amoeba1=new Amoeba();
Amoeba amoeba2=new Amoeba();
So when amoeba1 and amoeba2 collide, they are united.
My problem is these Amoeba collided when the square of their transparent area touched each other (I used getOneIntersectingObject).
So i tried code below.
But when i used these code (amoeba1 hits amoeba2):
the collision detected when the center of amoeba1 touched actual image of amoeba2.
Do you have any idea how to detect collision of their edge of actual image, of amoeba1 hits amoeba2 (ignore both of their transparent area).
Thank you my brothers.
1 2 3 4 | Amoeba amoeba = (Amoeba)getOneIntersectingObject(Amoeba. class ); if (amoeba.getImage().getColorAt(getX(), getY()).getAlpha() == 0 ){ //action } |