I want a spaceship to fly (player is only able to press up or down) until it hits a ball (which means game over) which is randomly spawned on the right side and you shortly have to dodge it afterwards. Because isTouching wasn't exact enough, I wanted to use java.util.List and
found this style on the internet, which I tried to adjust to my programme:
public void Find()
{
List <ball> actors = getObjectsInRange(80, ball.class);
if(actors != null)
{
if(getImage() == current){image = getImage();}; setImage ("gameover.png");setLocation(400,200);
if (Greenfoot.isKeyDown("up")) {setLocation (getX()+0,getY()+0);};if (Greenfoot.isKeyDown("up")) {setLocation(getX()+0,getY()+0);};
Greenfoot.stop();
}
Now I have several questions:
What does the null stand for?
Why doesn't the Spaceship get destroyed?
How can I do it, that if the centre of the Spaceship and the centre of a ball come together within the range of 80, that the spaceship gets destroyed?
Pls help me, I don't know how to do it.
P.S. I don't know much about programming, as you can probably see.

