I am making a game kind of like agar.io that i have to make it so if the user controlled object is bigger than the enemy, it "eats" it and removes the enemy from the world. I'm having a hard time figuring out how to get the Height and Width of the other class because it doesn't let me share variables between class. I already have the code for checking if you are touching an enemy and removing it by the way. Thanks in advance
public void killEnemy()
{
if (canSee(Enemy.class))
{
GreenfootImage User = getImage();
int x = User.getHeight();
int y = User.getWidth();
if (x > Enemy.getHeight() & y > Enemy.getHeight())
{
eat (Enemy.class);
}
else
{
eat (User.class);
}
}
