This is my scenario http://imageshack.us/photo/my-images/42/imagearl.png/ and i wanna make the "hero" climb the ladder, is the black thing, but i cant.
this is the code i have:
if (Greenfoot.isKeyDown("w") && checkLadder() ){
setImage("heroback.png");
moveUp();
}
public boolean checkLadder()
{
//stairs escada = (stairs) getOneIntersectingObject(stairs.class); <- tryed both none of this lines worked
Actor escada = getOneObjectAtOffset(0,0, stairs.class); <-
return escada!=null;
}
public void moveUp()
{
setLocation ( getX(), getY() - speed );
}