mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Particle, VFX] Add bounce ground friction property.
This commit is contained in:
parent
3e20df73f5
commit
6173fda1a1
10 changed files with 6264 additions and 6221 deletions
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
__migration_check();
|
__migration_check();
|
||||||
|
|
||||||
if(!instance_exists(_p_dialog) && !file_exists(file_open_parameter) && PREF_MAP[? "show_splash"])
|
if(!file_exists(file_open_parameter) && PREF_MAP[? "show_splash"])
|
||||||
dialogCall(o_dialog_splash);
|
dialogCall(o_dialog_splash);
|
||||||
#endregion
|
#endregion
|
|
@ -61,6 +61,7 @@ function __part(_node) constructor {
|
||||||
ground = false;
|
ground = false;
|
||||||
ground_y = 0;
|
ground_y = 0;
|
||||||
ground_bounce = 0;
|
ground_bounce = 0;
|
||||||
|
ground_friction = 1;
|
||||||
|
|
||||||
static create = function(_surf, _x, _y, _life) {
|
static create = function(_surf, _x, _y, _life) {
|
||||||
active = true;
|
active = true;
|
||||||
|
@ -94,10 +95,11 @@ function __part(_node) constructor {
|
||||||
spVec[1] = point_direction(0, 0, speedx, speedy);
|
spVec[1] = point_direction(0, 0, speedx, speedy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static setGround = function(_ground, _ground_offset, _ground_bounce) {
|
static setGround = function(_ground, _ground_offset, _ground_bounce, _ground_frict) {
|
||||||
ground = _ground;
|
ground = _ground;
|
||||||
ground_y = y + _ground_offset;
|
ground_y = y + _ground_offset;
|
||||||
ground_bounce = _ground_bounce;
|
ground_bounce = _ground_bounce;
|
||||||
|
ground_friction = clamp(1 - _ground_frict, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) {
|
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) {
|
||||||
|
@ -133,6 +135,9 @@ function __part(_node) constructor {
|
||||||
if(ground && y + speedy > ground_y) {
|
if(ground && y + speedy > ground_y) {
|
||||||
y = ground_y;
|
y = ground_y;
|
||||||
speedy = -speedy * ground_bounce;
|
speedy = -speedy * ground_bounce;
|
||||||
|
|
||||||
|
if(abs(speedy) < 0.1)
|
||||||
|
speedx *= ground_friction;
|
||||||
} else
|
} else
|
||||||
y += speedy;
|
y += speedy;
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
inputs[| 39] = nodeValue("Bounce amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
|
inputs[| 39] = nodeValue("Bounce amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
|
||||||
.rejectArray()
|
.rejectArray()
|
||||||
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
||||||
|
|
||||||
|
inputs[| 40] = nodeValue("Bounce friction", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1, "Apply horizontal friction once particle stop bouncing." )
|
||||||
|
.rejectArray()
|
||||||
|
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01 ]);
|
||||||
|
|
||||||
input_len = ds_list_size(inputs);
|
input_len = ds_list_size(inputs);
|
||||||
|
|
||||||
|
@ -135,7 +139,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
["Spawn", true], 27, 16, 1, 2, 3, 4, 30, 31, 24, 25, 5,
|
["Spawn", true], 27, 16, 1, 2, 3, 4, 30, 31, 24, 25, 5,
|
||||||
["Movement", true], 29, 6, 18,
|
["Movement", true], 29, 6, 18,
|
||||||
["Physics", true], 7, 19, 33, 20, 34, 35, 36,
|
["Physics", true], 7, 19, 33, 20, 34, 35, 36,
|
||||||
["Ground", true], 37, 38, 39,
|
["Ground", true], 37, 38, 39, 40,
|
||||||
["Rotation", true], 15, 8, 9,
|
["Rotation", true], 15, 8, 9,
|
||||||
["Scale", true], 10, 17, 11,
|
["Scale", true], 10, 17, 11,
|
||||||
["Color", true], 12, 28, 13, 14,
|
["Color", true], 12, 28, 13, 14,
|
||||||
|
@ -204,6 +208,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
var _ground = current_data[37];
|
var _ground = current_data[37];
|
||||||
var _ground_offset = current_data[38];
|
var _ground_offset = current_data[38];
|
||||||
var _ground_bounce = current_data[39];
|
var _ground_bounce = current_data[39];
|
||||||
|
var _ground_frict = current_data[40];
|
||||||
|
|
||||||
if(_rotation[1] < _rotation[0]) _rotation[1] += 360;
|
if(_rotation[1] < _rotation[0]) _rotation[1] += 360;
|
||||||
|
|
||||||
|
@ -302,7 +307,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
var _wiggle = random_range(_wigg[0], _wigg[1]);
|
var _wiggle = random_range(_wigg[0], _wigg[1]);
|
||||||
|
|
||||||
part.setPhysic(_vx, _vy, _acc, _gravity, _gvDir, _wiggle, _trn, _turnSc);
|
part.setPhysic(_vx, _vy, _acc, _gravity, _gvDir, _wiggle, _trn, _turnSc);
|
||||||
part.setGround(_ground, _ground_offset, _ground_bounce);
|
part.setGround(_ground, _ground_offset, _ground_bounce, _ground_frict);
|
||||||
part.setTransform(_scx, _scy, _scale_time, _rot, _rot_spd, _follow);
|
part.setTransform(_scx, _scy, _scale_time, _rot, _rot_spd, _follow);
|
||||||
part.setDraw(_color, _bld, _alp, _fade);
|
part.setDraw(_color, _bld, _alp, _fade);
|
||||||
spawn_index = safe_mod(spawn_index + 1, attributes.part_amount);
|
spawn_index = safe_mod(spawn_index + 1, attributes.part_amount);
|
||||||
|
@ -408,14 +413,26 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
var _dist = inputs[| 4].getValue();
|
var _dist = inputs[| 4].getValue();
|
||||||
var _scatt = inputs[| 24].getValue();
|
var _scatt = inputs[| 24].getValue();
|
||||||
var _dirAng = inputs[| 29].getValue();
|
var _dirAng = inputs[| 29].getValue();
|
||||||
|
var _turn = inputs[| 34].getValue();
|
||||||
|
var _colGnd = inputs[| 37].getValue();
|
||||||
|
|
||||||
inputs[| 6].setVisible(!_dirAng);
|
inputs[| 6].setVisible(!_dirAng);
|
||||||
|
|
||||||
|
inputs[| 25].setVisible(_scatt == 2);
|
||||||
|
|
||||||
|
inputs[| 30].setVisible(_dist == 2, _dist == 2);
|
||||||
|
inputs[| 31].setVisible(_dist == 3, _dist == 3);
|
||||||
|
|
||||||
|
inputs[| 35].setVisible(_turn[0] != 0 && _turn[1] != 0);
|
||||||
|
inputs[| 36].setVisible(_turn[0] != 0 && _turn[1] != 0);
|
||||||
|
|
||||||
|
inputs[| 38].setVisible(_colGnd);
|
||||||
|
inputs[| 39].setVisible(_colGnd);
|
||||||
|
inputs[| 40].setVisible(_colGnd);
|
||||||
|
|
||||||
inputs[| 22].setVisible(false);
|
inputs[| 22].setVisible(false);
|
||||||
inputs[| 23].setVisible(false);
|
inputs[| 23].setVisible(false);
|
||||||
inputs[| 26].setVisible(false);
|
inputs[| 26].setVisible(false);
|
||||||
inputs[| 25].setVisible(_scatt == 2);
|
|
||||||
inputs[| 30].setVisible(_dist == 2, _dist == 2);
|
|
||||||
inputs[| 31].setVisible(_dist == 3, _dist == 3);
|
|
||||||
|
|
||||||
if(is_array(_inSurf)) {
|
if(is_array(_inSurf)) {
|
||||||
inputs[| 22].setVisible(true);
|
inputs[| 22].setVisible(true);
|
||||||
|
@ -454,10 +471,14 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
||||||
static onPartStep = function(part) {}
|
static onPartStep = function(part) {}
|
||||||
static onPartDestroy = function(part) {}
|
static onPartDestroy = function(part) {}
|
||||||
|
|
||||||
|
static doSerialize = function(_map) { #region
|
||||||
|
_map.part_base_length = input_len;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
static postDeserialize = function() { #region
|
static postDeserialize = function() { #region
|
||||||
if(PROJECT.version < 11480) {
|
var _tlen = struct_try_get(load_map, "part_base_length", 40);
|
||||||
for( var i = 37; i <= 39; i++ )
|
|
||||||
array_insert(load_map.inputs, i, noone);
|
for( var i = _tlen; i < input_len; i++ )
|
||||||
}
|
array_insert(load_map.inputs, i, noone);
|
||||||
} #endregion
|
} #endregion
|
||||||
}
|
}
|
|
@ -106,7 +106,7 @@
|
||||||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
||||||
|
|
||||||
VERSION = 11530;
|
VERSION = 11530;
|
||||||
SAVE_VERSION = 11500;
|
SAVE_VERSION = 11530;
|
||||||
VERSION_STRING = "1.15.3.0";
|
VERSION_STRING = "1.15.3.0";
|
||||||
BUILD_NUMBER = 11530;
|
BUILD_NUMBER = 11530;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
|
|
||||||
UPDATE_PART_FORWARD
|
UPDATE_PART_FORWARD
|
||||||
|
|
||||||
static onUpdate = function() {
|
static onUpdate = function() { #region
|
||||||
RETURN_ON_REST
|
RETURN_ON_REST
|
||||||
|
|
||||||
if(PROJECT.animator.current_frame == 0)
|
if(PROJECT.animator.current_frame == 0)
|
||||||
|
@ -37,13 +37,13 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
}
|
}
|
||||||
outputs[| 0].setValue(_parts);
|
outputs[| 0].setValue(_parts);
|
||||||
}
|
}
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onSpawn = function(_time, part) {
|
static onSpawn = function(_time, part) { #region
|
||||||
part.step_int = inputs[| input_len + 1].getValue(_time);
|
part.step_int = inputs[| input_len + 1].getValue(_time);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onPartCreate = function(part) {
|
static onPartCreate = function(part) { #region
|
||||||
var vt = outputs[| 1];
|
var vt = outputs[| 1];
|
||||||
if(ds_list_empty(vt.value_to)) return;
|
if(ds_list_empty(vt.value_to)) return;
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
if(_n.value_from != vt) continue;
|
if(_n.value_from != vt) continue;
|
||||||
_n.node.spawn(, pv);
|
_n.node.spawn(, pv);
|
||||||
}
|
}
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onPartStep = function(part) {
|
static onPartStep = function(part) { #region
|
||||||
var vt = outputs[| 2];
|
var vt = outputs[| 2];
|
||||||
if(ds_list_empty(vt.value_to)) return;
|
if(ds_list_empty(vt.value_to)) return;
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
if(_n.value_from != vt) continue;
|
if(_n.value_from != vt) continue;
|
||||||
_n.node.spawn(, pv);
|
_n.node.spawn(, pv);
|
||||||
}
|
}
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onPartDestroy = function(part) {
|
static onPartDestroy = function(part) { #region
|
||||||
var vt = outputs[| 3];
|
var vt = outputs[| 3];
|
||||||
if(ds_list_empty(vt.value_to)) return;
|
if(ds_list_empty(vt.value_to)) return;
|
||||||
|
|
||||||
|
@ -86,9 +86,9 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
if(_n.value_from != vt) continue;
|
if(_n.value_from != vt) continue;
|
||||||
_n.node.spawn(, pv);
|
_n.node.spawn(, pv);
|
||||||
}
|
}
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||||
var spr = inputs[| 0].getValue();
|
var spr = inputs[| 0].getValue();
|
||||||
|
|
||||||
if(spr == 0) {
|
if(spr == 0) {
|
||||||
|
@ -104,5 +104,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
||||||
var cy = yy + h * _s / 2;
|
var cy = yy + h * _s / 2;
|
||||||
var ss = min((w - 8) / surface_get_width_safe(spr), (h - 8) / surface_get_height_safe(spr)) * _s;
|
var ss = min((w - 8) / surface_get_width_safe(spr), (h - 8) / surface_get_height_safe(spr)) * _s;
|
||||||
draw_surface_align(spr, cx, cy, ss, fa_center, fa_center);
|
draw_surface_align(spr, cx, cy, ss, fa_center, fa_center);
|
||||||
}
|
} #endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1497,6 +1497,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
|
|
||||||
for(var i = 0; i < amo; i++) {
|
for(var i = 0; i < amo; i++) {
|
||||||
if(inputs[| i] == noone || _inputs[i] == noone) continue;
|
if(inputs[| i] == noone || _inputs[i] == noone) continue;
|
||||||
|
|
||||||
|
//if(name == "Particle") print($"Apply {i} : {inputs[| i].name}");
|
||||||
inputs[| i].applyDeserialize(_inputs[i], load_scale, preset);
|
inputs[| i].applyDeserialize(_inputs[i], load_scale, preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1506,6 +1508,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
||||||
|
|
||||||
for(var i = 0; i < amo; i++) {
|
for(var i = 0; i < amo; i++) {
|
||||||
if(outputs[| i] == noone) continue;
|
if(outputs[| i] == noone) continue;
|
||||||
|
|
||||||
outputs[| i].applyDeserialize(_outputs[i], load_scale, preset);
|
outputs[| i].applyDeserialize(_outputs[i], load_scale, preset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,4 +105,6 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
|
||||||
cacheCurrentFrame(_outSurf);
|
cacheCurrentFrame(_outSurf);
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1583,9 +1583,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
if(fullUpdate) UPDATE |= RENDER_TYPE.full;
|
if(fullUpdate) UPDATE |= RENDER_TYPE.full;
|
||||||
else UPDATE |= RENDER_TYPE.partial;
|
else UPDATE |= RENDER_TYPE.partial;
|
||||||
|
|
||||||
|
if(!LOADING) PROJECT.modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!LOADING) PROJECT.modified = true;
|
|
||||||
cache_value[0] = false;
|
cache_value[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1703,6 +1704,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
node.onValueFromUpdate(index);
|
node.onValueFromUpdate(index);
|
||||||
node.clearCacheForward();
|
node.clearCacheForward();
|
||||||
|
|
||||||
|
PROJECT.modified = true;
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
@ -2249,7 +2251,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//printIf(TESTING, " |- Applying deserialize to junction " + name + " of node " + node.name);
|
//printIf(TESTING, " |- Applying deserialize to junction " + name + " of node " + node.name);
|
||||||
name = struct_try_get(_map, "name", name);
|
|
||||||
on_end = struct_try_get(_map, "on_end");
|
on_end = struct_try_get(_map, "on_end");
|
||||||
loop_range = struct_try_get(_map, "loop_range", -1);
|
loop_range = struct_try_get(_map, "loop_range", -1);
|
||||||
unit.mode = struct_try_get(_map, "unit");
|
unit.mode = struct_try_get(_map, "unit");
|
||||||
|
@ -2264,6 +2265,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
draw_line_shift_y = struct_try_get(_map, "shift_y");
|
draw_line_shift_y = struct_try_get(_map, "shift_y");
|
||||||
|
|
||||||
name_custom = struct_try_get(_map, "name_custom", false);
|
name_custom = struct_try_get(_map, "name_custom", false);
|
||||||
|
if(name_custom) name = struct_try_get(_map, "name", name);
|
||||||
|
|
||||||
animator.deserialize(struct_try_get(_map, "raw_value"), scale);
|
animator.deserialize(struct_try_get(_map, "raw_value"), scale);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue