Legacy GM Show subtitles/play sounds when num. of button clicks reaches certain amounts

C

CrashRocks1419

Guest
Hello everyone! I have a problem with some code in my game.

I am making a button simulator game, where when you get to so many clicks, an audio clip will play, along with subtitles to go along with the voices.

In obj_button Create event, I have
Code:
clicks = 0
which sets the variable iirc.

In the Left Released event, I have:

Code:
clicks += 1;
In obj_subtitle Draw GUI event, I have:
Code:
draw_set_alpha(0.4);
draw_set_colour(c_black);
if (clicks = 10){
    draw_roundrect(160,352,640,416,false);
}
... which should draw the box for the subtitles.

However, clicking the button 10 times does not create the subtitle box. Is there something I am forgetting in the code?
 

Relic

Member
Obj_subtitle has a variable clicks, as does obj_button.

Adding to the clicks variable for the button does not also add to the clicks variable for the subtitles.

Put the drawing code in the button obj or have the subtitle object check the button clicks by using obj_button.clicks (only valid if you only have one button instance)
 
Top