I have scaled images easily with the .getScaledInstance
when importing them like so:
player_sprite = a_1.getImage().getScaledInstance(150, 150, 100);
But the same cannot be said about scaling animated GIFs as when I do the same method of scaling a GIF it causes issues when displaying it. When using g.drawImage
it only draws the first frame then disappears.
Here is the full code for importing the GIF that I use and below will be an example of how I display the animated GIF onto the JFrame
:
Importing it:
ImageIcon a_1 = new ImageIcon(FrontHand.class.getResource("/Sprites/character_move_down.gif"));
move_player_down = a_1.getImage().getScaledInstance(100, 100, 100);
Displaying it:
g.drawImage(move_player_down, 100, 100, this);
Is there another simple method I could use for increasing the size of the animated GIF or is there a simple fix for this issue.