Jump to content


Photo

Blend mode to reduce alpha to 0


  • Please log in to reply
3 replies to this topic

#1 OTheB

OTheB

    GMC Member

  • GMC Member
  • 46 posts
  • Version:GM:Studio

Posted 28 March 2016 - 12:24 PM

Hello.

 

I have a surface on which I am drawing a form of background on the player, however the depth of this background needs to be lower than that of the player so it is drawn on top. What blend mode could I use to have the surface draw the player sprite on to reduce the alpha of that part of the surface to 0 so there is a player shaped "hole" in the surface so he is visible?

 

Thanks in advance


  • 0
Why is that man wearing a shoe on his head? Bcause it fits!
I leapt onto my horse and galloped off in all directions!

#2 cdrdub8

cdrdub8

    GMC Member

  • GMC Member
  • 518 posts
  • Version:GM:Studio

Posted 28 March 2016 - 10:31 PM

The depth doesn't decide which instance will be drawn over which instance...

The depth decide the ORDER in which instance are drawn.

So of course if you draw 2 things at the same position, the LAST ONE will be over it.

 

What you want to do is either make the player's depth smaller than the background,

or draw the player 2 times.

 

Once like you do now, before the background, and once AFTER the background is drawn.

I beleive there is a DRAW END event that could help :)

 

Hope this helps ~

- Cdrdub8


  • 0

I am building awesomeness, wait for it!


#3 obscene

obscene

    GMC Member

  • GMC Member
  • 3171 posts
  • Version:GM:Studio

Posted 29 March 2016 - 12:47 AM

bm_subtract


  • 0

#4 cdrdub8

cdrdub8

    GMC Member

  • GMC Member
  • 518 posts
  • Version:GM:Studio

Posted 29 March 2016 - 01:22 AM

bm_subtract

 

I made a quick example, you can Download it ( Mega, .gmz, 12 Ko )

 

Here is a screenshot:

6bfc33f035.png

 

In the 'Player' object, in the draw Event, if you remove the draw_circle code, you get this:
cfd22c9c7e.png

 

Successfully creating a hole in the big square ( player has depth 0, square is a surface with depth -100 )

 

Hope this helps ~

- Cdrdub8


  • 0

I am building awesomeness, wait for it!