Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_verlet_constrainpoints

(view raw script w/o annotations or w/e)
1
function scr_verlet_constrainpoints
scr_verlet_constrainpoints

function scr_verlet_constrainpoints(argument0, argument1, argument2) //gml_Script_scr_verlet_constrainpoints { for (var i = 0; i < array_length(argument0); i++) { var p = argument0[i] if (!p[4]) { var vx = (p[0] - p[2]) * argument1 var vy = (p[1] - p[3]) * argument1 if (p[0] > room_width) { p[0] = room_width p[2] = p[0] + vx * argument2 } else if (p[0] < 0) { p[0] = 0 p[2] = p[0] + vx * argument2 } if (p[1] > room_height) { p[1] = room_height p[3] = p[1] + vy * argument2 } else if (p[1] < 0) { p[1] = 0 p[3] = p[1] + vy * argument2 } } } }
(argument0, argument1, argument2) //gml_Script_scr_verlet_constrainpoints
2
{
3
    for (var i = 0; i < array_length(argument0); i++)
4
    {
5
        var p = argument0[i]
6
        if (!p[4])
7
        {
8
            var vx = (p[0] - p[2]) * argument1
9
            var vy = (p[1] - p[3]) * argument1
10
            if (p[0] > room_width)
11
            {
12
                p[0] = room_width
13
                p[2] = p[0] + vx * argument2
14
            }
15
            else if (p[0] < 0)
16
            {
17
                p[0] = 0
18
                p[2] = p[0] + vx * argument2
19
            }
20
            if (p[1] > room_height)
21
            {
22
                p[1] = room_height
23
                p[3] = p[1] + vy * argument2
24
            }
25
            else if (p[1] < 0)
26
            {
27
                p[1] = 0
28
                p[3] = p[1] + vy * argument2
29
            }
30
        }
31
    }
32
}