Page 1 of 1

My sprite is drawing "dim"

Posted: October 19th, 2017, 9:27 pm
by JazzyGeoff
Hi all,

This sounds ridiculous, I know, but my sprite from Intermediate 12 is displaying "dimmer" than it appears in the spritesheet. Have I missed something obvious? The white text is presented nice and bright.
I attach a grab showing the game window and the sprite-sheet for reference..(I set the spritesheet background to black for easier comparison in the screenshot, but it is saved as Magenta still in the file - honest).
dim_sprite.png
dim_sprite.png (19.12 KiB) Viewed 2146 times
Thanks, Geoff

Re: My sprite is drawing "dim"

Posted: October 20th, 2017, 1:44 am
by chili
Did you clone from the repo or write the code yourself? What does it look like when the sprite walks over the text?

Re: My sprite is drawing "dim"

Posted: October 20th, 2017, 6:48 am
by JazzyGeoff
Hi Chili, Thanks for responding, and well, for everything that led me here so far. I've enjoyed your videos very much, and watch them daily to speed up my commute to work.
Cloned directly from the repo with no change apart from required re-targeting to v141 for my VS2017 setup. I noticed it first of all when I tried my own sprite sheet where I was trying to create "Galaga" using your framework, then went back to just the original link spritesheet. I have re-tried this morning from a fresh clone of the repo, with the same result.
Grab attached showing the text in comparison to the sprite and the original sheet. I think you can still see that the sprite is dimmer in the game window. It's a strange one.
dim2.png
dim2.png (4.58 KiB) Viewed 2127 times
Thanks again,
Geoff

Re: My sprite is drawing "dim"

Posted: October 20th, 2017, 7:53 am
by chili
It's not a strange one bro. I suggest you follow the function calls and see what is actually being called, then report back here ;)

Re: My sprite is drawing "dim"

Posted: October 20th, 2017, 10:06 am
by JazzyGeoff
Ah-ha!! Ghost Effect! Phew. I thought I was going to have to plug in a CRT monitor to see if it made a difference for a moment there!

As Chili pointed out, if I had followed through all the function calls I would have seen that in the latest version, the call to Animation::Draw passes on a Ghost SpriteEffect to allow the text to be seen through the sprite...

void Animation::Draw( const Vei2& pos,Graphics& gfx ) const
{
gfx.DrawSprite( pos.x,pos.y,frames[iCurFrame],sprite,SpriteEffect::Ghost{ chroma } );
}

If I change this from Ghost{ chroma } to Chroma{ chroma }, then I get my desired result of a full brightness sprite, but with text that is hidden behind the sprite if they overlap.

I have learned a lesson to make sure that when I clone a repo, I must roll back to the correct place and branch-off from there, to avoid code that is newer than the tutorial I am working from.

Right, I'm off to prepare the next stupid question...
Thanks Chili!

Re: My sprite is drawing "dim"

Posted: October 20th, 2017, 3:08 pm
by chili
Well, you beat me to what i was gonna say next.

But yeah, you can use the tags to see where the commits for each tutorial are, and create your branches accordingly ;)