Hello,
I'm trying to do maze, I have this picture of maze - http://prntscr.com/pop6s1 and I need to make it solid. (The idea is.. actor can't go thought that black color).
import greenfoot.*;
import java.awt.Color;
public class Actor extends Actor
{
public void act()
{
if (Greenfoot.isKeyDown("left"))
{
this.turn(180);
this.move(3);
setRotation(0);
if (getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.black))
{
move (-1);
}
}
if (Greenfoot.isKeyDown("down"))
{
this.turn(90);
this.move(3);
setRotation(0);
if (getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.black))
{
move (-1);
}
}
if (Greenfoot.isKeyDown("up"))
{
this.turn(270);
this.move(3);
setRotation(0);
if (getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.black))
{
move (-1);
}
}
if (Greenfoot.isKeyDown("right"))
{
this.move(3);
if (getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.black))
{
move (-1);
}
}
}
}
(getWorld().getBackground().getColorAt(getX(), getY()).equals(Color.black)) = it's without error, but it also doesn't work.
I will be glad, if someone help me.

