The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

1. More BitmapData woes

I've recently tried to take my bitmapdata skills to the next level by creating my own animation and rotation classes to help bring life to a sitll image. However I might have set my sights a bit too high when I tried to create a multi-dimensional array that pre-compose all the necessary images for proper rotation, scale and opacity. I ALMOST have it but due to my lack of skill with matricies, I can't figuire it out :/ Here's what I got so far :

PHP Code:
var SRO:Array = new Array();
for (var
i:uint <= 10 i++){
var
newWidth:uint  width * (i+1)
var
newHeight:uint height * (i+1)

SRO[i] = new Array();
for (var
ii:Number = -18ii 19ii++){
var
rotationMatrix:Matrix = new Matrix();
var
temp:Number Math.sqrt((newWidth/2)*(newWidth/2)+(newHeight/2)*(newHeight/2));

rotationMatrix.identity()

rotationMatrix.translate(-newWidth2,-newHeight 2);

rotationMatrix.rotate(ii Math.PI/180 10);

rotationMatrix.translate(temp,temp);

rotationMatrix.scale(i+1,i+1);

SRO[i][ii] = new Array();
for (var
iii:uint iii <= 10 iii++){
var
ct:ColorTransform = new ColorTransform(1,1,1,iii*.1);

SRO[i][ii][iii] = new BitmapData(temp*2,temp*2,true,0);

SRO[i][ii][iii].draw(this,rotationMatrix,ct);
}
}

So SRO[0][0][10] would be a scale of 1, and rotation of 0 and opacity of 100%.

Rotation(ii) and opacity(iii) work fine, but for some reason it only scales the bmd's bounds and not the image itself.

On a side note, how do I get rid of the background of a bmd alltogether? Example attatched

**edit**apparently my host is down, anyone know where I can upload multiple files (including swf)temp link
Last edited by substance; April 18th, 2008 at 10:17 PM.

2. Create a class called texture to manage the rotation textures and give it a function where you can pass in an angle in radians and it will return the required texture. Like texture.GetTexture(0); will return textures[0] in the class since that represents 0 degrees. Also make the constructor so you can say the number or rotations like 35 and such.

Do you not understand how opacity works? Look up alpha blending. You don't have to store the rotated images and their opacities.
Last edited by Sirisian; April 18th, 2008 at 11:47 PM.

3. Originally Posted by Sirisian
Create a class called texture to manage the rotation textures and give it a function where you can pass in an angle in radians and it will return the required texture. Like texture.GetTexture(0); will return textures[0] in the class since that represents 0 degrees. Also make the constructor so you can say the number or rotations like 35 and such.

Do you not understand how opacity works? Look up alpha blending. You don't have to store the rotated images and their opacities.
I could create a texture manager but I prefer just having each object have a "rotationArray" that I can directly grab images from. I might create a manager in the future but now I'm just trying to get everything working.

Anyways, I havent heard of alpha blending. I got the idea of precomposing everything from the birchlab experiements and I saw that he had a sprite sheet that included transparency so I assumed it had to be done similarly. After doing a quick search I assume you're reffering to the "alphaBitmapData" parameter in the copyPixels method?

Btw,Sirisian, I just wanna thank you for all your extremely helpful posts in the past. I know you havent helped me directly but pretty much everything i've learned on this subject are from archived post you have made along with things like the tank game and your texture manager. The "introduction" to bitmapdata was also very informative.