![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | bluemage |
So I solved one of my problems using a TextureRect but it doesn’t seem to scale at all.
var s = Vector2()
...
s.x = 0.5
s.y = 0.5
...
cardn[cardcount].set_scale(s)
print(cardn[cardcount].get_scale())
This seems to output the .5 .5 vector2 I have but the image doesn’t scale at all. I’m trying to shrink it to about half the image size. What am I doing wrong?
have you tried changing the Stretch Mode
property of the TextureRect
?
Eric Ellingson | 2020-02-07 21:04
yes I can’t seem to figure it out. I tried going through them all with no luck but there may have been other factors so I’m not sure how to do it right if that’s the solution.
bluemage | 2020-02-07 23:05
I’ve tried various forms of this code to no avail. when I turn on expand the images disapear.
#cardn[cardcount].set_expand(true)
cardn[cardcount].set_scale(s)
print(cardn[cardcount].get_scale())
cardn[cardcount].set_custom_minimum_size(s)
#cardn[cardcount].set_stretch_mode(5)
cardn[cardcount].minimum_size_changed()
cardn[cardcount].rect_scale = s
#cardn[cardcount].apply_scale(s)
#cardn[cardcount].set_size(s)
#cardn[cardcount].scale = .5
setting scale in the GUI of godot works but I’m trying to do this with code…
bluemage | 2020-02-07 23:06
Here’s my full thought process. I’ve deleted Hboxcontainer and readded it to the scene so its in defaults. strech mode alone doesn’t seem to have any effect 0 -7 it all displays the pictures but not scaled down and when on 3 or 4 with expand it writes over the same spot and negates hboxcontainer. the other strech mode options with expand make the images disapear. get_scale returns that the rect_scale value is changing but my images don’t shrink.
cardn.append(TextureRect.new())
cardn[cardcount].set_name("card" + String(cardcount))
cardn[cardcount].texture = actual[showcard]
#cardn[cardcount].set_stretch_mode(3)
#cardn[cardcount].set_expand(true)
cardn[cardcount].set_scale(s)
print(cardn[cardcount].get_scale())
#cardn[cardcount].set_custom_minimum_size(s)
#cardn[cardcount].minimum_size_changed()
#cardn[cardcount].rect_scale = s
#cardn[cardcount].apply_scale(s)
#cardn[cardcount].set_size(s)
#cardn[cardcount].scale = .5
print(cardn[cardcount].name)
get_node("HBoxContainer").add_child(cardn[cardcount])
bluemage | 2020-02-08 01:22