mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
Particle path
This commit is contained in:
parent
c3051fa4d2
commit
64f4707b45
@ -78,6 +78,11 @@ function __part(_node) constructor {
|
||||
|
||||
frame = 0;
|
||||
|
||||
path = noone;
|
||||
pathIndex = 0;
|
||||
pathPos = new __vec2();
|
||||
pathDiv = noone;
|
||||
|
||||
static reset = function() { #region
|
||||
INLINE
|
||||
|
||||
@ -168,6 +173,13 @@ function __part(_node) constructor {
|
||||
alp_fade = _fade;
|
||||
} #endregion
|
||||
|
||||
static setPath = function(_path, _pathDiv) { #region
|
||||
INLINE
|
||||
|
||||
path = _path;
|
||||
pathDiv = _pathDiv;
|
||||
} #endregion
|
||||
|
||||
static kill = function(callDestroy = true) { #region
|
||||
INLINE
|
||||
|
||||
@ -294,6 +306,14 @@ function __part(_node) constructor {
|
||||
_xx = drawx + _pp[0];
|
||||
_yy = drawy + _pp[1];
|
||||
|
||||
if(path != noone) {
|
||||
var _div = pathDiv.get(lifeRat);
|
||||
|
||||
pathPos = path.getPointRatio(lifeRat, pathIndex, pathPos);
|
||||
_xx = _xx * _div + pathPos.x;
|
||||
_yy = _yy * _div + pathPos.y;
|
||||
}
|
||||
|
||||
if(exact) {
|
||||
_xx = round(_xx);
|
||||
_yy = round(_yy);
|
||||
|
@ -150,12 +150,22 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger", onClick: triggerSpawn, output: true })
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 45] = nodeValue("Follow Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 46] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone )
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 47] = nodeValue("Path Deviation", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 )
|
||||
.rejectArray();
|
||||
|
||||
input_len = ds_list_size(inputs);
|
||||
|
||||
input_display_list = [ 32,
|
||||
["Sprite", false], 0, 22, 23, 26,
|
||||
["Spawn", true], 27, 16, 44, 1, 2, 3, 4, 30, 24, 5,
|
||||
["Movement", true], 29, 6, 18,
|
||||
["Follow path", true, 45], 46, 47,
|
||||
["Physics", true], 7, 19, 33, 34, 35, 36,
|
||||
["Ground", true, 37], 38, 39, 40,
|
||||
["Rotation", true], 15, 8, 9,
|
||||
@ -190,6 +200,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
|
||||
curve_scale = noone;
|
||||
curve_alpha = noone;
|
||||
curve_path_div = noone;
|
||||
|
||||
for( var i = 0; i < attributes.part_amount; i++ )
|
||||
parts[i] = new __part(self);
|
||||
@ -235,6 +246,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
var _ground_bounce = getInputData(39);
|
||||
var _ground_frict = getInputData(40);
|
||||
|
||||
var _path = getInputData(46);
|
||||
|
||||
if(_rotation[1] < _rotation[0]) _rotation[1] += 360;
|
||||
|
||||
var _posDist = [];
|
||||
@ -330,6 +343,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
part.setGround(_ground, _ground_offset, _ground_bounce, _ground_frict);
|
||||
part.setTransform(_scx, _scy, curve_scale, _rot, _rot_spd, _follow);
|
||||
part.setDraw(_color, _bld, _alp, curve_alpha);
|
||||
part.setPath(_path, curve_path_div);
|
||||
|
||||
spawn_index = safe_mod(spawn_index + 1, attributes.part_amount);
|
||||
onSpawn(_time, part);
|
||||
|
||||
@ -389,9 +404,11 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
|
||||
var _curve_sca = getInputData(11);
|
||||
var _curve_alp = getInputData(14);
|
||||
var _curve_pth = getInputData(47);
|
||||
|
||||
curve_scale = new curveMap(_curve_sca, TOTAL_FRAMES);
|
||||
curve_alpha = new curveMap(_curve_alp, TOTAL_FRAMES);
|
||||
curve_scale = new curveMap(_curve_sca, TOTAL_FRAMES);
|
||||
curve_alpha = new curveMap(_curve_alp, TOTAL_FRAMES);
|
||||
curve_path_div = new curveMap(_curve_pth, TOTAL_FRAMES);
|
||||
#endregion
|
||||
|
||||
render();
|
||||
@ -456,6 +473,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
var _dirAng = getInputData(29);
|
||||
var _turn = getInputData(34);
|
||||
var _spwTyp = getInputData(16);
|
||||
var _usePth = getInputData(45);
|
||||
|
||||
inputs[| 6].setVisible(!_dirAng);
|
||||
|
||||
@ -470,6 +488,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||
inputs[| 23].setVisible(false);
|
||||
inputs[| 26].setVisible(false);
|
||||
|
||||
inputs[| 46].setVisible(true, _usePth);
|
||||
|
||||
inputs[| 1].setVisible(_spwTyp < 2);
|
||||
if(_spwTyp == 0) inputs[| 1].name = "Spawn delay";
|
||||
else if(_spwTyp == 1) inputs[| 1].name = "Spawn frame";
|
||||
|
@ -50,6 +50,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
|
||||
var loop = getInputData(0);
|
||||
if(!loop) return;
|
||||
|
||||
if(IS_PLAYING)
|
||||
for( var i = 0; i < TOTAL_FRAMES; i++ )
|
||||
for( var j = 0, m = ds_list_size(topoList); j < m; j++ ) {
|
||||
var node = topoList[| j];
|
||||
|
@ -83,7 +83,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
|
||||
|
||||
if(CURRENT_FRAME == 0) {
|
||||
reset();
|
||||
reLoop();
|
||||
if(IS_PLAYING) reLoop();
|
||||
}
|
||||
|
||||
if(IS_PLAYING) runVFX(frame);
|
||||
|
@ -501,7 +501,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
||||
var togl = array_safe_get(jun_disp, 2, noone);
|
||||
if(togl != noone) var toging = _inspecting.getInputData(togl);
|
||||
|
||||
var lbx = (togl != noone) * ui(36);
|
||||
var lbx = (togl != noone) * ui(40);
|
||||
var lbw = con_w - lbx;
|
||||
var ltx = lbx + ui(32);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user