GMS 2 Help draw event transparency (erasing a color)

Discussion in 'Programming' started by Thiago_Mn, Jul 23, 2019.

  1. Thiago_Mn

    Thiago_Mn Member

    Joined:
    Jul 20, 2019
    Posts:
    4
    Hello guys!

    Welp, i've been stuck how to erase or detect any color on a sprite, like gray or black.
    and i was trying to erase alot of sprites with differents colors in background, and i didn't found any solution to erase the background color of sprites (i'm trying to make the background transparency btw) i'm new on GameMaker Studio 2 (Started using 15 days ago), so i don't know much things yet, but here's what i'm trying to do:
    https://media.discordapp.net/attach...035785784066048/ssao.png?width=957&height=324

    i'm trying to remove the black color (and other any color too) with any code, but i don't know how, i've tried many ways and i still didn't get the solution...

    I appreciate any help of yours! :)
    (Btw, sorry for my bad English, i'm Brazillian)
     
  2. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    210
    @Thiago_Mn

    open the sprite in the sprite editor, and use the "colour remove tool" in the toolbox and click on the black background,

    [​IMG]

    [​IMG]colour remover tool


    if you are importing sprite sheets you need to split them into frames



    image >> import strip image or (CTRL+I)

    you can't use whole sprites sheets without spliting them into frames first
     
    Last edited: Jul 23, 2019
  3. Thiago_Mn

    Thiago_Mn Member

    Joined:
    Jul 20, 2019
    Posts:
    4
    Thanks! it was working fine

    but i just found another problem:
    https://media.discordapp.net/attach...03240379453669423/bs.png?width=973&height=268
    i tried to remove the black background of the effects and was still showing.
    What i tried to say up there, is how to delete like, colors over black and grey to white,
    that should be worked
    https://media.discordapp.net/attach...1517708083202/unknown.png?width=93&height=200
    like if any these colors be showed on the sprite, will be automatically deleted.
    i was wondering if it works with any Draw Event or something, any ideas?

    (Btw, sorry for my bad English and my bad example.)
     
  4. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    210
    @Thiago_Mn
    then start all over again.

    open the original sprite in photoshop, and remove the background using the magic background remover. and then import the sprite to game maker studio 2.

    make sure to save it in photoshop as a .PNG file, it's the only format that supports transparent backgrounds.


    if you import formats that are not PNG the transparent backgrounds will show as black.


    .jpg and other formats doesn't support transparent backgrounds
     
    Last edited: Jul 23, 2019
  5. Annoyed Grunt

    Annoyed Grunt Member

    Joined:
    Jun 20, 2016
    Posts:
    136
    NEVER use .jpg\.jpeg to save your assets! Unlike .png, which is a lossless compression format, .jpeg is a lossy compression format. Put simply, this means .png will try to rearrange its data so it occupies less space, while .jpg will throw away part of the data that it deems unnecessary, depending on the compression level. In addition to not supporting transparency, the compression will also make your sprites blurry and artifacted. To use a metaphor, using .png is like carefully arranging your luggage into your car so it all fits while using .jpg is like throwing one of the suitcases away because you don't really need the spare clothing inside of it.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice