I’m trying to use a tween to change the position of one of the points in a line2d, but I’m not sure what the syntax would be for this.

This is what I have: tween.tween_property(line, “points”, target_position, time)

Obviously this doesn’t work because points has more than one point to make the line. If I need index 1 of points specifically, how would I do that? Or do I have to address it as a whole PackedVector2Array?

EDIT: I found the answer to this in case anyone else stumbles across this. You use colons, like this:

tween.tween_property(line, "points:1, target_position, time)

  • TechieDamien@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Another way would be to add your own property with custom getter/setter and tween that. Your solution works, but more advanced things might be easier with this method.