I am working on a simple car game on greenfoot and I wanna add an alert sound if my car is getting closer to a truck
This was my trial in the truck class's act method but it keeps on showing an exception:
if(!getObjectsInRange(60, Car1.class).isEmpty())
{
Greenfoot.playSound("alert.wav");
}
please advise. Thank you.