by Tpot, quoted from the SFGHQ discord server.
Made this as a proof of concept for something. It's basically the Metropolis Zone boss animation in a couple lines of code. While it's in GML, it's so short, you can easily convert the logic. https://i.gyazo.com/79fde74271b9a2020745377d6cf3171b.mp4 Create:
nodeObj = objNode;
xRadius = 96;
yRadius = 96;
angle = 0;
aSpeed = 2;
nodeCount = 16;
for(i=0;i<nodeCount;i+=1)
nodes[i] = instance_create(x,y,nodeObj);
Update/Step
angle += aSpeed;
for(i=0;i<nodeCount;i+=1){
_r = i*(360/nodeCount)+angle;
deg = degtorad(_r);
_c = cos(deg);
_s = sin(deg);
nodes[i].x = x+xRadius*_c;
nodes[i].y = y+yRadius*_s;
}
0:07/0:07
The code shown here also has
xRadius += keyboard_check(vk_up) - keyboard_check(vk_down);
yRadius += keyboard_check(vk_right) - keyboard_check(vk_left);
To control the shape.
Though depth is not taken into account, only because GM8 acts oddly when you change an objects depths every frame.