Subj : Re: Transparency when using frames/sprites To : Kirkman From : MCMLXXIX Date : Wed Jun 18 2014 11:33 pm Re: Re: Transparency when using frames/sprites By: Kirkman to MCMLXXIX on Wed Jun 18 2014 16:04:37 > But I did run into a roadblock with sprites. I have a profile sprite that > changes depending on whether it is facing left or right. Using the code abov > the mask doesn't change when the sprite changes orientation, so basically th > wrong characters are being masked. > > What should I do differently to make sure each orientation has its own mask? > > Also, on a related note, where can I find what the numeric values in .attr > correspond to? it seems that 7 is black, but some other numbers also seemed > like they might be black as well. well, there are two ways to solve the first problem.the problem being that the srite image is larger than the frame, so when you iterate the frame using its dimensions, you are only scanning/modifying that portion of the sprite. solution 1: use the "use_offset" argument on the frame.getData() method, which should get the data in the frame using the sprite offset which is what causes it to change direction. this is the easiest fix, but not the most efficient. solution 2: iterate frame.data (this returns the entire graphic you loaded in) once, outside of the user input loop. you can do this once, immediately after loding the graphic in, so you arent doing it every single time it runs through your loop. you'll find the color values in sbbsdefs.js --- þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com) .