Happy new year everyone,
I managed to bbcode-tweak my RichTextLabel so that the first digit turns blue when a certain number of digits are entered:
var templateWriting = "[right][color=blue]{firstDigit}[/color]{remainingDigits}[/right]"
I can also make, for example, that first digit shake...
"[right][shake rate=15 level=20]{firstDigit}[/shake]{remainingDigits}[/right]"
This all works fine. But I can't have both effects at the same time. I thought that should work like this:
"[right][color=blue][shake rate=15 level=20]{firstDigit}[/color][/shake]{remainingDigits}[/right]"
But this doesn't seem to work. How could I achieve this?
LIKE THIS: [color] [shake] need to close in the right order [/shake] [/color]. Careful not to mix them up.
However, what my question is aiming for in the first place: how can I have that first digit to be set a little higher than the others? I was wondering if that could be done via "offset", maybe something like [offset = Vector2 (0, 20)]
, but I can't really figure it out. Or maybe this could be done with the RichTextLabel's custom fonts' property "extra_spacing_char
"?
Any help is mich appreciated!
(Weirdly enough, setting the shake rate to 0 and the level to e. g. 80 clearly changes the position of the digit (without shaking around, obviously). But there must be a proper way to do this...)
Like this:
[offset x=0 y=20]
Code would be something like this
tool
extends RichTextEffect
class_name RichTextOffset
var bbcode = "offset"
func _process_custom_fx(char_fx):
var x = char_fx.env.get("x", 0)
var y = char_fx.env.get("y", 0)
char_fx.offset = Vector2(x,y)
return true
The according video:
https://www.youtube.com/watch?v=o-cLQ7J1mc8
Thanks to art_critique on reddit!