I am a total newbie when it comes to Greenfoot. Taking a class in high school and I am absolutely loving it. How is it possible, say if my character is facing a wall (cells are 60pixels squared), how can I prevent him from moving into the wall when I press a button (up) to move forward? I need lots of help as I really don't know much when it comes to Java. If you help please try to tell me virtually every detail on what I need to do when I am implementing your help. Here is what I have so far, and it's not working the right way:
When I play my game, my character can't move up at all. They can move left, right etc. because I haven't made this code for those parts yet.
Please help!
Thanks for taking the time to read this!
if (Greenfoot.isKeyDown("up"))
{
if (getOneObjectAtOffset(0, 1, Wall.class) != null)
{
setRotation(270);
move(1);
}
}

