Pixel-Composer/scripts/node_VFX_accelerate/node_VFX_accelerate.gml

24 lines
764 B
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_VFX_Accelerate(_x, _y, _group = noone) : Node_VFX_effector(_x, _y, _group) constructor {
2022-12-13 09:20:36 +01:00
name = "Accelerate";
2022-12-16 09:18:09 +01:00
node_draw_icon = s_node_vfx_accel;
2022-12-13 09:20:36 +01:00
function onAffect(part, str) {
2024-12-25 04:52:25 +01:00
var _rot = random_range(rotateX, rotateY);
var _scX = random_range(scaleX0, scaleX1);
var _scY = random_range(scaleY0, scaleY1);
2022-12-13 09:20:36 +01:00
2024-12-25 04:52:25 +01:00
part.speedx = part.speedx + effectVx * str * strength;
part.speedy = part.speedy + effectVy * str * strength;
2022-12-13 09:20:36 +01:00
part.rot += _rot * str;
2024-12-25 04:52:25 +01:00
var scx_s = _scX * str;
var scy_s = _scY * str;
2022-12-13 09:20:36 +01:00
if(scx_s < 0) part.scx = lerp_linear(part.scx, 0, abs(scx_s));
else part.scx += sign(part.scx) * scx_s;
2024-12-25 04:52:25 +01:00
2022-12-13 09:20:36 +01:00
if(scy_s < 0) part.scy = lerp_linear(part.scy, 0, abs(scy_s));
else part.scy += sign(part.scy) * scy_s;
}
}