Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Possible To Change Colour Used For Transparency.

Author
Message
Dead Pixel
4
Years of Service
User Offline
Joined: 27th Nov 2014
Location:
Posted: 24th Feb 2015 00:44 Edited at: 24th Feb 2015 20:29
Hi there,

Is it possible to change the colour used to denote transparent areas in our sprites? I have several sprites with areas of black in them and AGK2 is interpreting these areas as transparent.

Can this setting \ colour be changed globally or is it set on a sprite-by-sprite basis?

I guess if it comes down to it I could change one of the RGB values to 1 instead of having all three of them at 0, to the end user this will still appear as black, but to AppGameKit it won't be and thus not interpret it as a transparent area. The only problem with this approach is the anti-aliasing along the edges of the black areas.

I did a Google search of the forums before posting, saw some threads relating to DBPro suggesting the use of Set Image Color Key() but didn't find what I was looking for in relation to AGK2.

Looking forward to your feedback, thanks.

//******************************
// Coding In BASIC using AppGameKit V2
//******************************
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Feb 2015 05:52
There is a command for this in AppGameKit :SetImageTransparentColor


Using AppGameKit V2 Tier 1
Dead Pixel
4
Years of Service
User Offline
Joined: 27th Nov 2014
Location:
Posted: 24th Feb 2015 20:35 Edited at: 24th Feb 2015 20:47
Thanks, baxslash.

I just tested a bit of code before posting this and I'm happy to report back that any sub images loaded in from an image to which this setting has been applied also inherit the setting, so you can set it once for the main image and forget about it. It looks like you can set a different colour for different images too. Nice one !!!

//******************************
// Coding In BASIC using AppGameKit V2
//******************************

Login to post a reply

Server time is: 2019-10-15 09:27:50
Your offset time is: 2019-10-15 09:27:50