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.

DarkBASIC Discussion / Sprite color help

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Feb 2008 21:05
Hey guys!

How can I make DarkBasic cut away a different colour around the outside? When I do this:



it automatically cuts away any black colour. How can I make it cut away white colour?

Thanks, TheComet

Oooooops!!! I accidentally formated drive c.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Feb 2008 00:40 Edited at: 9th Feb 2008 00:49
You can't have any colour other than black as transparent in a sprite/image with DB Classic. If your images are a different colour, you'll have to recolour them with a paint program.

Actually, to be totally correct, I believe that in DB Classic any colour with all the RGB values less than 11 as being transparent - but that's almost black anyway.

For example, RGB(1,1,1), RGB(2,2,2) alñl the way up to RGB(10,10,10) would all be transparent.

This is for when you have an image which has been softened and the edges fade gradually to black. If it was only colour 0,0,0 that was transparent, some sprites would have a black edge around them caused by the almost (but not quite) black pixels.

Disclaimer: It's a while since I did this and I've not checked if anything has changed in recent versions of DBC.

TDK_Man

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Feb 2008 00:58 Edited at: 9th Feb 2008 01:07
[EDIT]

TDK post beat mine!

Though I think in 32 bit, you can have rgb(1,1,1) and it won't be transparent.

[original post at the same time as TDK]
I think what you are talking about is trying to control the alpha channel or set the transparency to another color. I don't think DarkBASIC allows that.

Since you want an area to be transparent, it doesn't really matter if it's colored black or white as those colors won't show only what's behind them. But, if you want to keep a black area non-transparent and another area have transparency, then you have the non-transparent black be less black.



If you want to change a series of predefined images, you can do that too. Does your version of DBC have memblocks?

Enjoy your day.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Feb 2008 01:31
Quote: "TDK post beat mine!"


Weyhey!! It's usually me who has to edit my post because I was too slow!

And you are perfectly correct about what I said not being true in 32 bit mode. I tested your snippet in 16 bit and it did what I said.

Shows how long it is since I actually did it - back when DB games had to be written in 16 bit GFX mode or most people couldn't run them!

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Feb 2008 13:53
@ latch

Yes, it has memblocks. But now, we`re entering the problem that usually comes up in my threads:My DarkBasic is not enhanced and can not be enhanced, so I can`t use memblocks, even if they are available, which they are.

@ TDK

I never knew that colors higher than 0,0,0 are transparent...

Oooooops!!! I accidentally formated drive c.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Feb 2008 16:07
I think latch is right about the colours
I used to use rgb(8,8,8) for black on my sprites; I think 6 or lower is transparent in the default bit-depth.

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Feb 2008 02:41
Quote: "I can`t use memblocks, even if they are available, which they are"


I don't understand what that means. Does it mean you can type a command like MAKE MEMBLOCK FROM IMAGE 1,1, the compiler won't give you an error, but the task isn't performed? Or you just can't type any memblock commands at all?

Enjoy your day.
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 10th Feb 2008 02:53 Edited at: 11th Aug 2010 22:59
perhaps he's just not confident enough to use them yet.

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Feb 2008 20:50
No, no. You all understand it incorrectly. What I meant was, I can type the command MAKE MEMBLOCK FROM IMAGE 1,1, but the compiler will throw up and error saying "command only available in enhanced mode". And because I can`t enhance DarkBasic or upgrade to a higher version, I can`t use any memblocks.

Oooooops!!! I accidentally formated drive c.

Login to post a reply

Server time is: 2025-06-04 02:00:07
Your offset time is: 2025-06-04 02:00:07