" method getOneObjectAtOffset() in class Actor.class cannot be applied to given types; "
What that means? ;D
public void special() {
TeamRot teamrot = getOneObjectAtOffset(TeamRot.class); //xOffset and yOffset can be whatever you want
if(TeamRot == null) { //if the player is not hitting an opposing team member
//then it can catch the ball,
tryToCatchBall();
//put the code to move the player here
}
}
public void tryToCatchBall()
{
Ball ball = (Ball) getOneIntersectingObject(this);
if(ball != null) {
//we divide the width and height by 2 to get the space between the center of the player and the edge of the player's image.
int width = getImage().getWidth()/2;
int height = getImage().getHeight()/2;
if(direction.equals("west"))
ball.setLocation(getX()-width, getY());
else if(direction.equals("north"))
ball.setLocation(getX(), getY()-height);
else if(direction.equals("east"))
ball.setLocation(getX()+width, getY());
else if(direction.equals("south"))
ball.setLocation(getX(), getY()+height);
}
}