[ 6 posts ]  Reply to topicPost new topic 
Author Message
 [us]
 Post subject: Damage Effect HELP: Change palette of an enemy and return...
PostPosted: Thu Dec 08, 2016 9:57 am 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I'm honestly confused about how the palette extremely works (or somewhat). I just need help on how to change color and return it the way it was. I hope there is a simple way instead of a complicated ways to deal with this.
Image

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [zz]
 Post subject: Re: Damage Effect HELP: Change palette of an enemy and retur
PostPosted: Thu Dec 08, 2016 10:51 am 
User avatar
Member
[*]
In the draw event:

Code:

if (HurtPalette > 0)
{
 d3d_set_fog(1, c_white, 0, 0);
}

draw_self();

if (HurtPalette > 0)
{
 d3d_set_fog(0, c_white, 0, 0);
}

HurtPalette = max(HurtPalette - 1, 0);


Set HurtPalette to 0 at creation.
Set HurtPalette to 5 or 6 when hurt.

 
Top
Offline 
 
 
 [at]
 Post subject: Re: Damage Effect HELP: Change palette of an enemy and retur
PostPosted: Thu Dec 08, 2016 12:00 pm 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
^No, this only works when the sprite is pure white. That's not the case here.
You either need a separate sprite for that or use a shader (there should be a recoloring shader included in the official Demos). There are no recoloring functions (at least in 1.x, not sure about GMS2).

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Damage Effect HELP: Change palette of an enemy and retur
PostPosted: Thu Dec 08, 2016 6:37 pm 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
Physix wrote:
In the draw event:

Code:

if (HurtPalette > 0)
{
 d3d_set_fog(1, c_white, 0, 0);
}

draw_self();

if (HurtPalette > 0)
{
 d3d_set_fog(0, c_white, 0, 0);
}

HurtPalette = max(HurtPalette - 1, 0);


Set HurtPalette to 0 at creation.
Set HurtPalette to 5 or 6 when hurt.


Seems to awesomely work enough for me! Thanks! :)

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [tr]
 Post subject: Re: Damage Effect HELP: Change palette of an enemy and retur
PostPosted: Thu Dec 08, 2016 11:20 pm 
User avatar
Thanks DonnieTheGuy!
Administrator
[A]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
DJ Coco wrote:
^No, this only works when the sprite is pure white. That's not the case here.
You either need a separate sprite for that or use a shader (there should be a recoloring shader included in the official Demos). There are no recoloring functions (at least in 1.x, not sure about GMS2).

Not really, you can use d3d_set_fog to fade a sprite to a specific color. I think you're confusing how it works with draw_set_color.

_________________
Image
 
Top
Offline 
 
 
 [at]
 Post subject: Re: Damage Effect HELP: Change palette of an enemy and retur
PostPosted: Fri Dec 09, 2016 4:11 am 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
Mors wrote:
DJ Coco wrote:
^No, this only works when the sprite is pure white. That's not the case here.
You either need a separate sprite for that or use a shader (there should be a recoloring shader included in the official Demos). There are no recoloring functions (at least in 1.x, not sure about GMS2).

Not really, you can use d3d_set_fog to fade a sprite to a specific color. I think you're confusing how it works with draw_set_color.
No, I'm aware of that. What I meant is that you can't make specific parts of the sprite pure white while retaining other colors using d3d_set_fog. In the GIF in the OP it looks like certain parts of the sprite fade to pure white while other pixels are only partially recolored.

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
 [ 6 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group