Well, I’m pretty stumped on this one. I’m using a BitmapData and a while loop to find the ground on my video game, but for some reason, the bitmapdata only gets half the sprite it’s based off. I know this because I printed it out as a bitmap. If I move the sprite before I capture the bitmapdata, it still only gets half, measured from the left edge of the stage. Anybody else ever had this problem?
usually this will happen if your graphics are centered in the object you’re drawing from, putting 0,0 in the center when draw() draws from 0,0 down and to the right. I don’t know if that’s what happening with you, but I thought I’d throw it out there.
That sounds sort of like my problem, except that my draw() is drawing from the stage’s 0,0 coordinates instead of the sprite’s coordinates. I can’t think of why it would only get half, however. Here’s my code:
currLevel = new LevelOne();
currLevelBmd = new BitmapData(currLevel.width, currLevel.height);
currLevelBmd.draw(currLevel);
Even if I call the draw() after I’ve moved the sprite (currLevel), it still gives me the same problems. All help is appreciated; I’m really stumped.
It depends what you’re moving and where. currLevelBmd will take the 0,0 location in currLevel and draw out to the right currLevel.width and down currLevel.height. Whatever is in that area appears in the bitmap.
So, how do I change the 0, 0 location to the top corner and get the whole sprite, instead of a portion?
if you draw inside the class instead, it’ll use it’s position instead of its parent.