I have a animation which goes to the left, but it also has to go to the right. Can I use the mirrorHorizontally in GreenfootImage to flip the images and still keep the animation and if yes, who should I do it?


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | private static GreenfootImage[] frame = new GreenfootImage[number of frames you have multiplied by two and add one] public myActor() { frame[ 0 ] = new GreenfootImage( "firstFrame" ); frame[ 1 ] = new GreenfootImage( "secondFrame" ); frame[ 2 ] = new GreenfootImage( "firstFrame" ); frame[ 3 ] = new GreenfootImage( "secondFrame" ); for ( int i = 2 ; i < 3 ; i++) { frame[i].mirrorHorizontally(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /** [number of frames you have multiplied by two and add one]*/ private static GreenfootImage[] frame = new GreenfootImage public Leatherface() { frame[ 0 ] = new GreenfootImage( "leatherface0" ); frame[ 1 ] = new GreenfootImage( "leatherface1" ); for ( int i = 0 ; i < 1 ; i++) { frame[i].mirrorHorizontally(); } } |