Hi all!
I am new to Wade and am playing around with some of its features.
I used the path tool to create multiple paths and would like to change the duration of each node such that my sprite moves along all pathes at the same constant speed independant of how long they are. (To achieve this more easily, an alternative option besides "duration" would probably be good, something like "speed"?).
To do this, I think I need to calculate the length of each path and take into account my desired speed to get the duration I have to set for each node. I haven't done this yet, I at first tried to find out how to set the duration via code.
At the documentation there is a function "setNode".
However, for me it only says "The data to set for the node. This is an object that can contain any of the following fields (all optional):
Where properties is an object that can contain any number of custom fields." and not the actual fields which are allowed.
I tried the following in the "onPathNode" function of my sprite which I want to move along the path:
var node = {duration:0.9};
this.getPath().setNode(0,node);
var node = {duration:0.9};
this.getPath().setNode(1,node);
My idea is that I want to update the "duration" field of node 0 and 1, but leave everything else as it is of node 0 and 1.
However, my sprite does not move along the path anymore. How can this be done?
An idea for improvement: Why is the "nodeIndex" argument inside "setNode" function? Wouldn't it be cleaner to have a set of setX(...) functions which can be called on the node retrieved via the"getNodeRef" function where X are the properties like "duration"?
(Edit: Maybe it's not really cleaner, but just what I am used to? :))
In the documentation there seems to be only "getPath()" (get the active path).
Wouldn't it be nice to have function which returns all pathes in the scene to iterate over them to set the desired values? This could then be done in the App function.
Another thing which just comes to my mind: If I e.g. misspell a function name, the game does not load anymore. Is there a way to get feedback / debug what lines caused the error inside the web IDE?
That's all for the moment :) It would be great to get feedback!