So I am trying to scale this object called "Mushroom" whenever it collides with the laser class. I am trying to make the Mushroom's height scale by 3/4. However, when I click the run button, I get this error:
java.lang.IllegalArgumentException: Width (25) and height (0) cannot be <= 0
How do I fix this? The height is an instance variable set as 25 in the Mushroom() function.
Here is the code for the function:
private void laserCollision(){ Actor laser = getOneIntersectingObject(Laser.class); if (laser != null){ GreenfootImage image = getImage(); image.scale(width, height * (3/4)); } }