Hello, I want one of my actors to pick up a powerup when touching it and then perform its effect. There are different powerups however it's all the same class. There is an integer that specifies which kind of powerup they are. So for the actor that picks them up to know the powerup's type, I tried this:
The error says, the method getType() was not found but the class Powerup contains just that method. I think the problem is, that the getOneIntersectingObject-method returns an actor (and not a Powerup?) but I can't figure out how to fix this. The only way I know is to make each powerup an own class but I would like to avoid that.
Thanks in advance for your suggestions.
public void pickUpPowerup()
{
Actor powerup = getOneIntersectingObject( Powerup.class );
if( powerup != null )
{
switch( powerup.getType() )
{
....

