dicksonlaw583 / GMTwerk2

Callback-based timing and tweening library for GameMaker Studio 2.3+
MIT License
15 stars 2 forks source link

Crash with multi-value using StructVec #4

Closed Manukineko closed 2 years ago

Manukineko commented 2 years ago

Hello,

I'm not sur if this is a bug or me who set it up the wrong way.

I am tweening two struct variable values:

//Create
item1 = {
            scale:2,
            xscale:1,
            yscale:1
}
Tween(StructVec(["xscale","yscale"],item1), StructVec(["scale","scale"],item1),400, [
    "type",te_cubic_out,
    "blend", tb_vector
]);

But, it seems the tb_vector function is feeded the whole target struct. image

Am I doing something wrong ?

dicksonlaw583 commented 2 years ago

Tween takes one selector and one target value, you gave it two selectors. The actor that takes two selectors is Track.

Either you do this for a one-time transition:

Tween(StructVec(["xscale", "yscale"], item1), [item1.scale, item1.scale], 400, [
    "type", te_cubic_out,
    "blend", tb_vector,
]);

Or this to keep xscale and yscale following scale on an ongoing basis:

Track(StructVec(["xscale", "yscale"], item1), StructVec(["scale", "scale"], item1), 400, [
    "type", te_cubic_out,
    "blend", tb_vector,
]);
Manukineko commented 2 years ago

Got it. Thanks.

I was wrongly assuming, based on the exemple shown for multiple values, that Tween would work the same way with StructVec than it works with InstanceVec.

Thanks again, GMTwerk is a lot of fun to use.

dicksonlaw583 commented 2 years ago

You are welcome. I will close this issue as it appears to be resolved. Feel free to let me know when you have other questions about GMTwerk 2.