Since some users are tired of getting bugged by the alerts from the original topic. I thought I open this one.
Please continue the discussion here.
int ax = getX() - getImage().getWidth()/2;
int ay = getY() - getImage().getHeight()/2;
List<String> axc = new ArrayList();
System.out.println("----This:----");
for(int ix=0; ix<getImage().getWidth(); ix++) {
int dx = ax+ix;
for(int iy=0; iy<getImage().getHeight(); iy++) {
int dy = ay+iy;
axc.add(dx+","+dy);
System.out.println(dx+","+dy);
}
}
Actor other = (Actor)getWorld().getObjects(cls).get(0);
int bx = other.getX() - other.getImage().getWidth()/2;
int by = other.getY() - other.getImage().getHeight()/2;
List<String> bxc = new ArrayList();
System.out.println("----Other:----");
for(int ix=0; ix<other.getImage().getWidth(); ix++) {
int dx = bx+ix;
for(int iy=0; iy<other.getImage().getHeight(); iy++) {
int dy = by+iy;
bxc.add(dx+","+dy);
System.out.println(dx+","+dy);
}
}
for(String coordinate : axc) {
if(bxc.contains(coordinate)) {
System.out.println("Found matching coordinate: "+coordinate);
return true;
}
}
return false;