"Hello world!"
I am trying to remove an object that blocks off the end of my world after i pickup a "Key" item.
I know I am doing something wrong but i can't figure out how i should make it work.
I know "getWorld().removeObject(LevelDetect.class);" does not work, because i need an actor for that.
Does that mean i need to list the LevelDetect's in the world and then call them or is it entirely something else?
Thanks in advance!
I have the following code
public class Alice extends Mover
{
private boolean hasKey = false;
public void act()
{
checkCollisionKey();
checkCollisionLevel();
checkHasKey();
}
public void checkCollisionKey()
{
Actor collided;
collided = getOneIntersectingObject(Key.class);
if (collided !=null)
{
hasKey=true;
getWorld().removeObject(collided);
getWorld().addObject(new Key2(), 180,10);
}
}
private void checkHasKey()
{
if(hasKey !=true)
{
getWorld().removeObject(LevelDetect.class);
}
}
private void checkCollisionLevel()
{
Actor collided;
collided = getOneIntersectingObject(LevelDetect.class);
if(collided !=null)
{
setLocation(getX()-1, getY());
}
}


