Is it possible to smoothStep the boss or bullets? How would I go about writing that code?
I did try to do this myself. I made a basic linear movement but that can be done easier using SetAtWeight/SetAtSpeed/SetAccel/etc. When I tried to make a smoothStep, it just jumps to the end destination (or Worse).
Forgot about this, sorry. You mostly had it right, but you forgot or missed that smoothstep is supposed to bound the interpolated values between 0 and 1. When you increment
t0 in your code, it's already 1. To get the smoothstepped value,
-2(1)3+3(1)2 = 1, so your delta is 1, then you move to
x0 + 1 * (x1 - x0) = x1 and oops you're done already. Notably, if you give smoothstep a value above 1, the squares and cubes will return a larger value than 1. With the input bounded from 0 to 1, you'll return a value between 0 and 1, as intended.
All you need to do instead is have your t0 value go from 0 to 1, so if you want it to last t1 frames, you increase t0 by 1/t1 per frame.
The other problem is just that you were setting a new x0 and y0 every frame. The
dT * (x1 - x0) part is your change in x from x0 (origin coordinate), so changing x0 all the time accelerates it and it doesn't work properly (Add back in the
x0 = ObjMove_GetX(obj) every frame to see what I mean).
task smoothStep(obj, x1, y1, t1){
let t0 = 0; // Start Time
let x0 = ObjMove_GetX(obj); // X-origin
let y0 = ObjMove_GetY(obj); // Y-origin
while(t0 < 1) {
let dT = t0 ^ 2 * (3 - 2 * t0); // Time-delta
let smoothX = x0 + dT * (x1 - x0); // X-origin + X-delta
let smoothY = y0 + dT * (y1 - y0); // Y-origin + Y-delta
ObjMove_SetPosition(obj,smoothX,smoothY);
t0+=1/t1; // Ranges from 0 to 1 over t1 frames
yield;
}
}