I am having issues with my code. What I wish for it to do is for the salt to disappear when it reaches the bottom of the world or at the coordinates 600 for the y value. I am still new to greenfoot and Java in general and some help would be appreciated.
Oh the context, I am creating a game where you play a slug dodging falling salt pieces that would kill you if you touch it.
Thanks in advance c:
- Slug
/**
* Act - do whatever the salt wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
int x = getX();
int y = getY();
setLocation( x, y + 2);
if (y == 600)
{
Actor actor = getOneIntersectingObject(salt.class);
getWorld().removeObject(actor);
}

