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
21
G
15
Posts: 1,039
Reputation: 15,134

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
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

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
21
G
15
Posts: 1,039
Reputation: 15,134

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
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

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
21
G
15
Posts: 1,039
Reputation: 15,134

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
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu May 10, 2012 2:05 pm

Might try Canvas.
Write text, set position, set color, paste into canvas, repeat.....
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

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
4
S
1
G
1
Posts: 69
Reputation: 863

Post » Thu May 10, 2012 7:04 pm

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

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests