//Object 1: (draw event)
draw_text(x,y, global.Score);
draw_set_alpha(0.5);
//Object 2: (draw_event)
draw_text(x,y, global.highscore);
draw_set_alpha(1);
问题是,绘制的对象(没有精灵)有时会从另一个中获得alpha,甚至忽略" draw_set_alpha();" (步骤事件中相同)
答案 0 :(得分:0)
当您使用draw_set_alpha()以及其他draw_set_ ..方法时,您可以更改全局设置,以便在整个项目之后绘制所有内容。
通常,在绘制所需内容后,还原此类设置。因此,根据您上面的代码,您应该使用:
//Object 1: (draw event)
var prev_alpha = draw_get_alpha(); //getting current alpha settings
draw_set_alpha(0.5); // setting needed alpha
draw_text(x,y, global.Score); //drawing text with 0.5 alpha
draw_set_alpha(prev_alpha); // setting alpha setting back
// the same for the second object
//Object 2: (draw_event)
var prev_alpha = draw_get_alpha();
draw_set_alpha(1);
draw_text(x,y, global.highscore);
draw_set_alpha(prev_alpha);