2023-02-28 09:43:01 +01:00
|
|
|
function Node_Rigid_Global(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
2023-12-22 08:42:02 +01:00
|
|
|
name = "RigidSim Global";
|
2023-01-25 06:49:00 +01:00
|
|
|
color = COLORS.node_blend_simulation;
|
|
|
|
icon = THEME.rigidSim;
|
2024-03-28 14:18:02 +01:00
|
|
|
setDimension(96, 96);
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2023-12-22 08:42:02 +01:00
|
|
|
manual_ungroupable = false;
|
|
|
|
|
2023-01-25 06:49:00 +01:00
|
|
|
object = noone;
|
|
|
|
|
2024-08-18 06:16:20 +02:00
|
|
|
newInput(0, nodeValue_Vec2("Gravity", self, [ 0, 10 ]));
|
2023-01-25 06:49:00 +01:00
|
|
|
|
|
|
|
current_gra = [0, 0];
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static update = function(frame = CURRENT_FRAME) {
|
2023-10-02 08:57:44 +02:00
|
|
|
var _gra = getInputData(0);
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
if(current_gra[0] != array_safe_get_fast(_gra, 0) || current_gra[1] != array_safe_get_fast(_gra, 1)) {
|
2023-01-25 06:49:00 +01:00
|
|
|
physics_world_gravity(_gra[0], _gra[1]);
|
|
|
|
|
|
|
|
current_gra[0] = _gra[0];
|
|
|
|
current_gra[1] = _gra[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-05 07:16:44 +01:00
|
|
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
2023-01-25 06:49:00 +01:00
|
|
|
var bbox = drawGetBbox(xx, yy, _s);
|
|
|
|
draw_sprite_fit(s_node_rigidSim_global, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
|
|
|
}
|
|
|
|
}
|