Skip to content

How do you add multiple different images into 1 animation? #2510

Answered by Cheemsandfriends
lchmoddev asked this question in Q&A
Discussion options

You must be logged in to vote

I am trying to make a game, but I have encountered a problem where I need 2 different .png files to be in one animation, but I can't figure out how to do it.

I answered this on the Haxe's discord server, but the worst answer that I can give is this:

var bitmap = Assets.getBitmapData(Path1);
var bitmap2 = Assets.getBitmapData(Path2);
// max is a function I use for comparing ints, but basically it's `return a < b ? b : a;`
var bitmapDraw = new BitmapData(max(bitmap.width, bitmap2.width), bitmap.height + bitmap2.height, true, 0x00000000);
bitmapDraw.draw(bitmap);
bitmapDraw.draw(bitmap2, new FlxMatrix(1,0,0,1, 0, bitmap.height));

bitmap = bitmapDraw;

I don't think it's the best solution b…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lchmoddev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants