GML Elliptic Direction

zghaun

Member
Hello there! how was your day?

Ok so, I am having problems with the GREEN CIRCLE following the direction of the BLUE LINE

The BLUE LINE point to the direction of the mouse and have manage to make the GREEN CIRCLE follow Elliptical trail of WHITE CIRCLES
The WHITE ELLIPSE mimics the direction of the RED LINE

Here is the STEP code for running the whole event, I can't figure out what I did wrong

Image Link

// VARIABLES
var rot = 360/30; // Divide 360 Degree by 30 Circles
var ox = x; // Position of Ellipse
var oy = y; // Position of Ellipse
var d = dir; // RED LINE DIRECTION
var p_d = point_direction(x,y,mouse_x,mouse_y); // POINT TO MOUSE
var v = 200; // VERTEX
var cv = 75; // CO-VERTEX

// MOVE WHITE CIRCLES
for(e=0;e<30;e++)
{
var t = e/divide;
var dc = dcos(d); // USE RED LINE DIRECTION
var ds = dsin(d); // USE RED LINE DIRECTION
var _x = v * cos(t); // BASICALLY LENGTHDIR
var _y = cv * -sin(t); // BASICALLY LENGTHDIR
with(b[e]) // SELECT ALL WHITE CIRCLES TO MOVE
{
x = ox + (dc * _x) + (ds * _y);
y = oy + (dc * _y) - (ds * _x);
}
}
// SELECT GREEN CIRCLE TO MOVE
with(po)
{
x = ox + dc * lengthdir_x(v , p_d) + ds * lengthdir_y(cv , p_d);
y = oy + dc * lengthdir_y(cv , p_d) - ds * lengthdir_x(v , p_d);
}
 
Top