first color in a sprite

Advanced game related topics
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

first color in a sprite

Post by Hroudtwolf »

Hello comunity,


My program should load many sprites with different backgroundcolors.
Then it should display the sprites transparent.
The most certain method could be select the first color in the upper left of the sprite and setting this color as transparentcolor.

Now my question:

How to determine the first color in the upper left of a sprite without displaying at first?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

My brains functions again. :-)

Here is the solution.

Code: Select all

Procedure ErsteFarbeTransparent(sprite.l)
If StartDrawing (SpriteOutput(sprite.l))
farbe.l=Point(0,0)
StopDrawing ()
EndIf 
TransparentSpriteColor(sprite.l,Red(farbe.l),Green(farbe.l),Blue(farbe.l))
EndProcedure 
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Perfect, this should be moved to Tips & Tricks :)
User avatar
griz
Enthusiast
Enthusiast
Posts: 167
Joined: Sun Jun 29, 2003 7:32 pm
Location: Canada

Post by griz »

What if the sprite needs that pixel for color data?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

Then, you must write another position in >POINT(x,y)<.
Post Reply