Hi Programmers,
I am wondering what the best way to both switch and scale images in a constructor. I want to reduce the sizes of the sprites in code rather than in Photoshop or something similar. For instance, I know about making new object variables like...
image1 = new GreenfootImage("sprite1.png");
image2 = new GreenfootImage("sprite2.png");
image3 = new GreenfootImage("sprite3.png");
setImage(image1);
and I know about how to scale images using something like this...
getImage().scale(getImage().getWidth()/3,getImage().getHeight()/3);
and I know about calling a custom method to switch sprites, such as...
public void switchImage() {
if (getImage() == image1)
{
setImage(image2);
}
else
{
setImage(image1);
}}
However, I'd like to know the BEST way to keep all of the sprite images scaled or reduced down during a game.
Thanks much!