I was trying to display an image using setImage().
I can do it one way
leaf.setImage("skull.png");
but not via a method in leaf that I created.
leaf.munched();
which basically calls setImage : this.setImage("skull.png");
If I create a new object:
Leaf aLeaf = new Leaf();
I can access the munched() method I created.
But if I try to access the method I created by using this :
Actor leaf = getOneObjectAtOffset(0, 0, Leaf.class);
The method is not available.
Anyone tell me what I am getting confused about?
Thanks.
/**
* Eat a leaf.
*/
Leaf aLeaf = new Leaf();
public void eatLeaf()
{
Actor leaf = getOneObjectAtOffset(0, 0, Leaf.class);
Actor wombat = getOneObjectAtOffset(0, 0, Wombat.class);
if(leaf != null) {
// eat the leaf...
getWorld().removeObject(this);
leaf.munched();
//leaf.setImage("skull.png");
leavesEaten = leavesEaten + 1;
}
}


