Text color

For questions about using Classic.

Post » Wed May 09, 2012 8:12 pm

Is there a way to display text with more than one color? For example:
"Status: open"
Maybe I can use python for this, but I dont know how
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,209

Post » Thu May 10, 2012 1:19 am

You can't do that with the Text object.
B
10
S
6
G
3
Posts: 127
Reputation: 2,481

Post » Thu May 10, 2012 1:37 am

You can do that using Lucid's Spritefont plugin. Konjak and him talked about this exact thing around page 4 in the spritefont topic (I had to figure this out too a while back.)

I had a hard time pulling it off without the game crashing though; spritefont is kind of unstable..maybe make your own? R0j0 made a C2 example on bitmap fonts that should translate ok.
Image
B
234
S
27
G
13
Posts: 1,784
Reputation: 18,274

Post » Thu May 10, 2012 2:30 am

@Tokinsom
The problem is that I need to position the text dynamically, and spritefont can't be moved... but thx
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,209

Post » Thu May 10, 2012 2:32 am

Can't you attach ("pin") spritefont to an object? If not then nevermind. Pretty sure spritefont is the only way to do this unless you make your own text system :\Tokinsom2012-05-10 02:33:23
Image
B
234
S
27
G
13
Posts: 1,784
Reputation: 18,274

Post » Thu May 10, 2012 3:15 am

Spritefont has the "attach" event, but if I recall correctly, it doesn't work
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,209

Post » Thu May 10, 2012 1:04 pm

Why not using two text instances? You can change the parameters independantly. To select the correct instance in runtime you could add a pv and use a condition.

Example: text_instances.captulamide2012-05-10 13:04:26
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Thu May 10, 2012 2:05 pm

Might try Canvas.
Write text, set position, set color, paste into canvas, repeat.....
Image ImageImage
B
164
S
49
G
137
Posts: 7,945
Reputation: 91,356

Post » Thu May 10, 2012 3:46 pm

I thumb for tulamide's idea, remember 7soul, you may add some private vars to the text object, just like an 'owner_id' or 'phrase_id', then pick them by that private, then maipulates it, just like move, resize, etc....
B
7
S
2
G
1
Posts: 81
Reputation: 1,056

Post » Thu May 10, 2012 7:04 pm

@tulamide @Yaottabyte @newt
Thx guys, I'll try these ideas
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,209

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests