• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Surface 'remove back' issue

Chaser

Member
I'm creating a sprite from a surface, well, more than one actually and everything seems to be OK, all but one sprite(so far).

in the syntax there is 'removeback' argument. which i understand how it works, or at least i thought i did so i think someone may have to explain to me if they can what is happening.

i don't want the sprite being created to have a background colour, so i set it to true. pretty easy to understand i think. :)
But for one sprite it is constantly giving it a 'White' background. have no idea why, as the code is no different to any of the others, only difference is the x and y co-ordinates from where the sprite is being created. So i tested the 'removeback' argument on this particular sprite and set it to false and it did remove the background White colour. This seems to be operating backwards? especially from the rest. However it didn't just remove the White background colour, it actually removed all the White from the sprite, which is something i didn't want to happen. After reading the manual a there was a sentence that i found interesting.

"Removeback - Indicates whether to make all pixels with the background colour (left-bottom pixel) transparent."

i think this could be the answer to my troubles. "Left - bottom pixel". Left bottom pixel from where? the sprite that is being drawn to the surface before creating a sprite from it?, or the sprite being created from the surface? there is no colours on the bottom left pixel, it is 'transparent'. I'm a bit confused about this. I don't know why it just wont work like the rest, it's baffling.

any ideas of what could be causing this 'weird' behaviour? i would be very grateful. :)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
i think this could be the answer to my troubles. "Left - bottom pixel". Left bottom pixel from where? the sprite that is being drawn to the surface before creating a sprite from it?, or the sprite being created from the surface? there is no colours on the bottom left pixel, it is 'transparent'. I'm a bit confused about this. I don't know why it just wont work like the rest, it's baffling.
This is a throwback to the old versions of GameMaker, where the left-bottom pixel of the sprite was used to set the "transparent" colour. EG: If you have a 100x100 sprite, then the pixel at (0, 100) would be the one that is used to determine the "transparent" colour, and all pixels with that colour would be removed from the sprite. If you are creating a sprite from a surface, it's the same. If the sprite being created is 100x100 it's the (0,100) pixel. And even if the pixel is transparent, it still has colour data... so that colour will still be removed from the sprite, regardless of the alpha value for it.
 

Chaser

Member
Yeah, I can appreciate that ‘transparency’ still has colour data. Would be good if there was a way I could ‘control’ or know what that colour data is. White seems to be the ‘default’ colour. Anything white disappears, other colours remain. I changed the colour from white to purple to test and the other colour remains no problem. Slightly annoying when my character has a white hat, or white socks, or even white within the eyes. :)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
If you call draw_clear_alpha on the surface beforehand, and set the colour that way it should work (with the colour component of the draw clear being used).
 
Top