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.

Dark GDK / changing color of a sprite

Author
Message
pepebotellas
14
Years of Service
User Offline
Joined: 22nd Jan 2010
Location:
Posted: 8th Feb 2010 15:15
Hello,

I am working on a 2 player game where each player has a set of pieces. One player will be color blue, the other one red.

Is there a way to change the blue color on a sprite to red (or from any color to another color)? I don't want to redraw all my pieces in red color.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 8th Feb 2010 16:04
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 8th Feb 2010 17:19
Try using the

dbSpriteRed
dbSpriteBlue

commands, it should be exactly what your looking for.

Showing it in action, ignore the alpha parts at the start.


www.touchofdeathproductions.com
pepebotellas
14
Years of Service
User Offline
Joined: 22nd Jan 2010
Location:
Posted: 8th Feb 2010 17:36
Hey, thanks for the reply.
They seem to be affecting the whole image, is there a way to make them only change one specific color?

Like certain tone of blue to change it to a certain tone of red?

My sprites are similar to those of Marsh0, and i would like to change only the clothes but not the face or the hair.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Feb 2010 20:30
The computer can't magically know where the clothes are on your sprite. One option is to make new sprites which contain JUST the clothes, the rest being transparent, and make them white. Then you can use 'set sprite diffuse' on those sprites, and overlay them on the originals.

pepebotellas
14
Years of Service
User Offline
Joined: 22nd Jan 2010
Location:
Posted: 8th Feb 2010 21:02
I know the computer can't magically find out where the clothes are on my sprites , that is why I am asking if I can change one specific color to another. say a fully blue shirt to a fully red shirt.

Your approach sounds reasonable, but not quite what I want. I would prefer to have 1 sprite sheet per character.

Is there a way to do pixel manipulation with GDK?
Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 9th Feb 2010 04:24 Edited at: 9th Feb 2010 04:31
Pix manipulation. Yes. using the Bitmaps.. So what you will have to do is load the image, paste it to a bitmap, then loop through each pixle and if it is red change it to a blue one. Its possible. A little slow though, because once this is done you will have to cut the image from the bitmap then set it as a sprite.

dbPoint(x, y) will return the color value at the specific point on the current bitmap. dbDot(x,y,color) will paint a pix at that point in the color specified, and dbDot(x,y) will paint that pix the current foreground color set with dbInk.

if(enemy == Amnzero) runAway();
Amnzero->WebSite = L"http://neovance.com/";
pepebotellas
14
Years of Service
User Offline
Joined: 22nd Jan 2010
Location:
Posted: 10th Feb 2010 03:02
Thanks Amnzero,

I'll give that a try sometime this week.

Login to post a reply

Server time is: 2024-11-20 05:30:51
Your offset time is: 2024-11-20 05:30:51