You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the 3.x version of the Tween API, there were follow_method and follow_property, which could be used to tween to a dynamic target value. The new Tween API (#41794) does not have this functionality, with no replacement.
Fix proposal: Extend the existing Method and Property Tweeners to be able to follow a value which is evaluated during tween processing, instead of a fixed value at Tween creation.
var me = self
var target = $Some/Node
create_tween().tween_method(func(t): me.global_position = target.global_position, 0, 1, 5)
I was initially confused by this method, but after I realized what it does it was left out, because it's super-specific and possible to achieve in a different way.
It requires more boilerplate than the previous way to do this, though. But perhaps it is better to have a more general method for this instead of the specific follow methods, now that there are inline anonymous functions. Maybe this should be noted in the release notes or the Tween docs for migrating existing code.
(Separately, I don't know what the closure rules are for GDScript 2, but if anonymous funcs closed over the outer scope's self, it would match the behavior of () => syntax in JavaScript, which I think would help some people moving from web game scripting.)
Godot version
v4.0.dev.20211015.official [f113dc9]
System information
Windows 10
Issue description
In the 3.x version of the Tween API, there were
follow_method
andfollow_property
, which could be used to tween to a dynamic target value. The new Tween API (#41794) does not have this functionality, with no replacement.Fix proposal: Extend the existing Method and Property Tweeners to be able to follow a value which is evaluated during tween processing, instead of a fixed value at Tween creation.
Steps to reproduce
Migrate any 3.x Tween-reliant code which uses the
follow_method
andfollow_property
functions.Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: