So, in a basic maze test, I'm trying to make the player class detect walls and stuff by using getColorAt on an image.
This is what I've got:
It's not working :/ The outputs aren't even working.
Anyone know how I can do this?
//color the search for private Color black = new Color(0, 0, 0, 255);
private void checkWalls()
{
world wld = (world) getWorld();
if (wld.bGround.getColorAt(x + 16, y) == black)
{
x--;
System.out.println("top");
}
if (wld.bGround.getColorAt(x - 16, y) == black)
{
x++;
System.out.println("bottom");
}
if (wld.bGround.getColorAt(x, y + 16) == black)
{
y--;
System.out.println("right");
}
if (wld.bGround.getColorAt(x, y - 16) == black)
{
y++;
System.out.println("left");
}
}

