0 votes

Hi,

It is possible to had a variable or something else in bbcode like this ?
I want the image to be responsive.

[img=90vw]{image path}[/img]
or
[img=90%]{image path}[/img]

Thanks !

Godot version 3,3 rc6
in Engine by (172 points)

1 Answer

0 votes
Best answer

you want to use a % sign in a string? if so use %%

my_var = "my percentage: %s%%" % int(round((float(CURRENT_VAR) / MAX_VAR) * 100))
print(my_var)
my percentage: 100%
by (360 points)
selected by

Thanks but not working.
Found a "simple" solution :

var size = "500" (or get_viewport_rect().size.x)
[img=" + size + "]res://image.png[/img]
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.