My Scenario
Why does the ball remove itself from the world? It's clearly not at the x and y coordinates of the box.
void pickUpBall()
{
if (Greenfoot.isKeyDown("p")) {
if (getObjectsAtOffset(0, 0, Ball.class) != null) {
isHoldingBall = true;
ball.isBeingHeld = true;
}
}
carryBall();
} void pickUpBall()
{
if (Greenfoot.isKeyDown("p")) {
if (getObjectsAtOffset(0, 0, Ball.class) != null) {
isHoldingBall = true;
ball.isBeingHeld = true;
}
}
carryBall();
} void carryBall()
{
if (isHoldingBall) {
ball.setLocation(getX(), getY());
}
}if (Greenfoot.isKeyDown("p")) {
if (getObjectsAtOffset(0, 0, Ball.class) != null) {
isHoldingBall = true;
ball.isBeingHeld = true;
}
}