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

Color for each text

P

Phemus

Guest
I want to change text color of each text, I use draw_set_color(col) but it changes all text colors. Please help.
 

Bingdom

Googledom
You can use it multiple times in 1 script
e.g.
DRAW EVENT
Code:
draw_set_colour(c_blue);
draw_text(x,y,"Hello");
draw_set_colour(c_red);
draw_text(x,y,"#World!");
draw_set_colour(c_black);
 
P

Phemus

Guest
I'm using;

Create Event:
global.name = "Guest_123"
global.gems = "0"
draw_set_color(c_white)

Step Event:
(I pressed a key):
global.name = get.string("Name","")
draw_set_color(c_green)


^^ But For step event when I use it, all text colors turns to green
 

Bingdom

Googledom
It is because draw_set_colour applies to everything, not just your 1 object.
You will need to have a variable in your draw event for the colour, so you would do something like this.

(Pressed a key)
color = c_green;

DRAW EVENT
draw_set_color(color);
draw_text()
draw_set_color(c_white);
 
P

Phemus

Guest
Okay i'll explain everything. I got cheat codes in player step event and I got object name called "isim"(name).

In cheat event I can't check codes right now but I'll try to explain.

...
}
else if cheat = "/owner
{
global.name = get_string("Your name","")
draw_set_color(c_green);
}
else if cheat = "/gems"
{
global.gems = get_string("Gems amount","")
draw_set_color(c_white);
}

^^ Can you fix this, example when I use /owner code every text turns to green and after using /gems every text turns to white.
 

Bingdom

Googledom
}
else if cheat = "/owner
{
global.name = get_string("Your name","")
color = c_green;
}
else if cheat = "/gems"
{
global.gems = get_string("Gems amount","")
color = c_white;
}

DRAW EVENT
draw_set_color(color);
//What ever you what to show in that color
draw_set_color(black);

You need to set the color back to black after from drawing the text, otherwise it will effect everything else
 
Last edited:
P

Phemus

Guest
}
else if cheat = "/owner
{
global.name = get_string("Your name","")
color = c_green;
}
else if cheat = "/gems"
{
global.gems = get_string("Gems amount","")
color = c_white;
}

DRAW EVENT
draw_set_color(color);
//What ever you what to show in that color
draw_set_color(black);

You need to set the color back to black after from drawing the text, otherwise it will effect everything else
Do you mean color_get_value cause there is no code with "color", and color_get_value or color_get_green not working.
 

Bingdom

Googledom
Set color to c_black in the create event and add

else {
color = c_black;
}

to the end of that step event line
 
Top