Advanced game related topics
ricardo_sdl
 
Posts: 19
Joined: Fri Jan 10, 2020 12:30 pm

TransparentSpriteColor?

by ricardo_sdl Sat Aug 29, 2020 4:00 pm

Hi!
On PureBasic I'm using TransparentSpriteColor to set a color as transparent (the background color of all my sprites). But this command is not present on SpiderBasic (I'm trying to create a code base that compiles on both PureBasic and SpiderBasic). How could I implement this behavior on SpiderBasic?
Thank you all!
You can check my games at:
https://ricardo-sdl.itch.io/
plouf
 
Posts: 64
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: TransparentSpriteColor?

by plouf Sat Aug 29, 2020 5:07 pm

There is DisplayTransparentSprite which use alphachannel (png 32bit)
User avatar
Paul
 
Posts: 101
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada

Re: TransparentSpriteColor?

by Paul Sat Aug 29, 2020 5:09 pm

Convert your Sprites to PNG with transparency layer and use those instead.

Both PB and SB will load the transparent sprite with LoadSprite() and the #PB_Sprite_AlphaBlending flag and display with DisplayTransparentSprite().
You also get the cleanest and smoothest edges compared to keying out a single color with TransparentSpriteColor()
ricardo_sdl
 
Posts: 19
Joined: Fri Jan 10, 2020 12:30 pm

Re: TransparentSpriteColor?

by ricardo_sdl Sun Aug 30, 2020 10:06 pm

Thanks! That's the way to go!
You can check my games at:
https://ricardo-sdl.itch.io/
Return to Game Programming

Who is online

Users browsing this forum: No registered users and 1 guest