Pixel-Composer/scripts/node_rigid_group/node_rigid_group.gml

36 lines
828 B
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor {
2023-01-25 06:49:00 +01:00
name = "RigidSim";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
2023-03-28 06:58:28 +02:00
update_on_frame = true;
2023-01-25 06:49:00 +01:00
2023-03-28 06:58:28 +02:00
ungroupable = false;
2023-01-25 06:49:00 +01:00
update_on_frame = true;
2023-03-28 06:58:28 +02:00
collIndex = irandom_range(1, 9999);
2023-01-25 06:49:00 +01:00
if(!LOADING && !APPENDING && !CLONING) {
2023-10-09 07:36:20 +02:00
var _output = nodeBuild("Node_Rigid_Render_Output", 256, -32, self);
2023-01-25 06:49:00 +01:00
}
2023-04-04 09:49:33 +02:00
static reset = function() {
instance_destroy(oRigidbody);
2023-04-10 20:02:59 +02:00
2023-04-04 09:49:33 +02:00
physics_pause_enable(true);
2023-01-25 06:49:00 +01:00
2023-04-04 09:49:33 +02:00
var node_list = getNodeList();
for( var i = 0; i < ds_list_size(node_list); i++ ) {
2023-07-25 20:12:40 +02:00
var _node = node_list[| i];
if(variable_struct_exists(_node, "reset"))
_node.reset();
2023-04-04 09:49:33 +02:00
}
2023-04-10 20:02:59 +02:00
2023-04-04 09:49:33 +02:00
physics_pause_enable(false);
}
2023-01-25 06:49:00 +01:00
2023-04-04 09:49:33 +02:00
static update = function() {
2023-10-09 16:07:33 +02:00
if(CURRENT_FRAME == 0)
2023-04-04 09:49:33 +02:00
reset();
}
2023-03-08 14:59:54 +01:00
PATCH_STATIC
2023-01-25 06:49:00 +01:00
}