Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | abelgutierrez99 |
Hi,
I need to make something every time some Spatial.translation
changes. The trivial solution would be to write that_function(Spatial.translation)
inside all the functions in which Spatial.translation
changes.
I neither want to use a _process(delta)
or similar function because it is a turn-based game.
Thanks!
Have you looked at setters and getters to help with your problem?
Ertain | 2021-12-29 03:37
Could you give us more information on the operations you want to perform on each attribute modification
Midonk | 2021-12-29 12:51
It seems that it does not work for my case since Spatial.translation
is already defined:
var translation : Vector3 setget changeTranlation
gives
The member 'translation' alredy exists in a parent class
abelgutierrez99 | 2021-12-30 13:22
I want to change Spatial.name
everytime Spatial.translation
changes. This Spatial
s are voxels in a voxel-based game, so it is sometimes useful that Spatial.name = var2str(Spatial.translation)
.
This days I had an idea so I do not need this feature, but not tested yet. Otherwise, it would be a good idea to know how to solve a similar problem, noticing that setget
does not work for already defined variables (built-in).
abelgutierrez99 | 2021-12-30 13:28