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();
|
||||
|
||||
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);
|
||||
#endregion
|
|
@ -61,6 +61,7 @@ function __part(_node) constructor {
|
|||
ground = false;
|
||||
ground_y = 0;
|
||||
ground_bounce = 0;
|
||||
ground_friction = 1;
|
||||
|
||||
static create = function(_surf, _x, _y, _life) {
|
||||
active = true;
|
||||
|
@ -94,10 +95,11 @@ function __part(_node) constructor {
|
|||
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_y = y + _ground_offset;
|
||||
ground_bounce = _ground_bounce;
|
||||
ground_friction = clamp(1 - _ground_frict, 0, 1);
|
||||
}
|
||||
|
||||
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) {
|
||||
|
@ -133,6 +135,9 @@ function __part(_node) constructor {
|
|||
if(ground && y + speedy > ground_y) {
|
||||
y = ground_y;
|
||||
speedy = -speedy * ground_bounce;
|
||||
|
||||
if(abs(speedy) < 0.1)
|
||||
speedx *= ground_friction;
|
||||
} else
|
||||
y += speedy;
|
||||
|
||||
|
|
|
@ -128,6 +128,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
.rejectArray()
|
||||
.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_display_list = [ 32,
|
||||
|
@ -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,
|
||||
["Movement", true], 29, 6, 18,
|
||||
["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,
|
||||
["Scale", true], 10, 17, 11,
|
||||
["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_offset = current_data[38];
|
||||
var _ground_bounce = current_data[39];
|
||||
var _ground_frict = current_data[40];
|
||||
|
||||
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]);
|
||||
|
||||
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.setDraw(_color, _bld, _alp, _fade);
|
||||
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 _scatt = inputs[| 24].getValue();
|
||||
var _dirAng = inputs[| 29].getValue();
|
||||
var _turn = inputs[| 34].getValue();
|
||||
var _colGnd = inputs[| 37].getValue();
|
||||
|
||||
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[| 23].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)) {
|
||||
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 onPartDestroy = function(part) {}
|
||||
|
||||
static doSerialize = function(_map) { #region
|
||||
_map.part_base_length = input_len;
|
||||
} #endregion
|
||||
|
||||
static postDeserialize = function() { #region
|
||||
if(PROJECT.version < 11480) {
|
||||
for( var i = 37; i <= 39; i++ )
|
||||
array_insert(load_map.inputs, i, noone);
|
||||
}
|
||||
var _tlen = struct_try_get(load_map, "part_base_length", 40);
|
||||
|
||||
for( var i = _tlen; i < input_len; i++ )
|
||||
array_insert(load_map.inputs, i, noone);
|
||||
} #endregion
|
||||
}
|
|
@ -106,7 +106,7 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
||||
|
||||
VERSION = 11530;
|
||||
SAVE_VERSION = 11500;
|
||||
SAVE_VERSION = 11530;
|
||||
VERSION_STRING = "1.15.3.0";
|
||||
BUILD_NUMBER = 11530;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
|
|||
|
||||
UPDATE_PART_FORWARD
|
||||
|
||||
static onUpdate = function() {
|
||||
static onUpdate = function() { #region
|
||||
RETURN_ON_REST
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onSpawn = function(_time, part) {
|
||||
static onSpawn = function(_time, part) { #region
|
||||
part.step_int = inputs[| input_len + 1].getValue(_time);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onPartCreate = function(part) {
|
||||
static onPartCreate = function(part) { #region
|
||||
var vt = outputs[| 1];
|
||||
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;
|
||||
_n.node.spawn(, pv);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onPartStep = function(part) {
|
||||
static onPartStep = function(part) { #region
|
||||
var vt = outputs[| 2];
|
||||
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;
|
||||
_n.node.spawn(, pv);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onPartDestroy = function(part) {
|
||||
static onPartDestroy = function(part) { #region
|
||||
var vt = outputs[| 3];
|
||||
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;
|
||||
_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();
|
||||
|
||||
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 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);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
|
||||
}
|
|
@ -1497,6 +1497,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1506,6 +1508,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
if(outputs[| i] == noone) continue;
|
||||
|
||||
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);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
|
||||
}
|
|
@ -1583,9 +1583,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(fullUpdate) UPDATE |= RENDER_TYPE.full;
|
||||
else UPDATE |= RENDER_TYPE.partial;
|
||||
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
}
|
||||
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
cache_value[0] = false;
|
||||
}
|
||||
|
||||
|
@ -1703,6 +1704,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
node.onValueFromUpdate(index);
|
||||
node.clearCacheForward();
|
||||
|
||||
PROJECT.modified = true;
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
|
@ -2249,7 +2251,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return;
|
||||
|
||||
//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");
|
||||
loop_range = struct_try_get(_map, "loop_range", -1);
|
||||
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");
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue