Let’s say I’ve got a sprite sheet / strip on one .png and load it as a tile into my game.
The character in the file is headed to the right. I want to flip the tile to the left so I only rely on one png-file, even when the character runs left.
(sample: Office Man Character by Jimmy D. Journey)
I tried this code snippet which wouldn’t work
var tileSource_flipped = Res.office_man_character.toTile(); //tile source
tileSource_flipped.flipX(); // this should work, shouldn't it?
var tileArray2d = tileSource_flipped.grid(12);
var tiles = new Array<h2d.Tile>();
tiles.push( tileArray2d[0][0] ); // (code snippet here without for-loop)
tiles.push( tileArray2d[1][0] );
tiles.push( tileArray2d[2][0] );
tiles.push( tileArray2d[3][0] );
tiles.push( tileArray2d[4][0] );
tiles.push( tileArray2d[5][0] );
var walking_anim_backwards = new Anim(tiles, 5);
So isn’t tileSource_flipped.flipX()
the solution here or did I use it in a wrong way?
Thank you.