This is a method written by the programmer.There are several things happening in the code to initiate different actions, as follows: The Leaf will be removed and an ‘eating’ sound will be played.Īctor leaf = getOneIntersectingObject(Leaf.class) If they are, the Wombat needs to look as though it has eaten the Leaf. getOneIntersectingObject is a method looking for an object from the Leaf class that the Wombat is intersecting with.A local variable ‘Leaf’ has been created for the Actor class in this method.It will have been called from the act() method.
The parameter value is returned and is stored in the variable ‘Leaf’.‘Leaf.class’, in brackets, is a value, called a parameter value.