Hey Matharoo,
I'm really enjoying the tool, its immensely helpful! I was hoping you could help me out with a little implementation, though.
The attach points work fine with a character with image_x/yscale = 1 and image_angle = 0, but in betweens I'm having trouble figuring out the correct algorithm.
I got the 4 combinations of image_xscale -1 / 1 and image_yscale -1 /1 to work right using 4 if statements, but adding image_angle to the mix has been difficult. I'm thinking I need to remove image_yscale from the mix and just use image_xscale and image_angle. I would appreciate any thoughts you might have on the subject. Or perhaps you wouldn't mind sharing the code that you use?
Here's a sample of the code I'm using. The attached point is a particle emitter, so emitterX/Y/Direction are the values I use after recalculating from the original attach points.
var _curr_attach_point = _attach_points[_curr_index];
var _offset_x = _curr_attach_point[0];
var _offset_y = _curr_attach_point[1];
var _length = sqrt(sqr(_offset_x) + sqr(_offset_y));
var _adj_x = lengthdir_x(_length,image_angle);
var _adj_y = lengthdir_y(_length,image_angle);
// Normal direction
if (image_xscale > 0 && image_yscale > 0) {
emitterX = x + _adj_x;
emitterY = y + _adj_y;
emitterDirection = _curr_attach_point[2];
// Flipped horizontally
} else if (image_xscale < 0 && image_yscale > 0) {
emitterX = x - _adj_x;
emitterY = y + _adj_y;
emitterDirection = 180 - _curr_attach_point[2];
// Flipped vertically
} else if (image_xscale > 0 && image_yscale < 0) {
emitterX = x + _adj_x;
emitterY = y - _adj_y;
emitterDirection = 180 - _curr_attach_point[2];
// Flipped horizontally and vertically
} else if (image_xscale < 0 && image_yscale < 0) {
emitterX = x - _adj_x;
emitterY = y - _adj_y;
emitterDirection = 180 + _curr_attach_point[2];
}
emitterDirection += image_angle;
I appreciate any help you can give! I'm really liking your tool! As well as your tutorials!
Will