• 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!

GameMaker [SOLVED] alpha blending issues

D

dirkinz

Guest
I have a game in which the player can essentially draw a line by dragging an object around. The line (made with draw_line_width()) is somewhat transparent and that's where the issue comes in. If the player draws back over the line it adds the alpha of the old line and the new line together. I want the line to display at a constant transparency no matter how many times it gets layered over itself. I'm just starting to look at blend modes and surfaces and I think they are the answer but I'm a bit overwhelmed by them. I'm unsure of the best way to accomplish this.

solved:
iirc it's just:
Code:
draw_set_alpha(/* alpha */);
    draw_surface(/* your surface stuff */);
draw_set_alpha(1);
or draw_surface_ext() if you prefer.
 
Last edited by a moderator:
G

Guest User

Guest
none of your images are working for me but i would think the solution to this is simply drawing the lines themselves as opaque (alpha = 1) and drawing the surface itself with decreased alpha a/o blend modes.
 
D

dirkinz

Guest
none of your images are working for me but i would think the solution to this is simply drawing the lines themselves as opaque (alpha = 1) and drawing the surface itself with decreased alpha a/o blend modes.
Sorry about the images. That makes a lot of sense. I was having trouble finding how to change the alpha of a surface though. I'll give it annoys look in the morning with a fresh mind though.
 
G

Guest User

Guest
iirc it's just:
Code:
draw_set_alpha(/* alpha */);
    draw_surface(/* your surface stuff */);
draw_set_alpha(1);
or draw_surface_ext() if you prefer.
 
D

dirkinz

Guest
ok. awesome. I didn't realize that draw_set_alpha() would affect the drawing of whole surfaces. Thank you so much for the help.
 
Top