Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_verlet_rope_generator_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if instance_exists(obj_verlet_rope_generator)
4
    image_alpha = obj_verlet_rope_generator.image_alpha
5
scr_verlet_updatepoints
scr_verlet_updatepoints

function scr_verlet_updatepoints(argument0, argument1, argument2) //gml_Script_scr_verlet_updatepoints { for (var i = 0; i < array_length(argument0); i++) { var p = array_get(argument0, i) if (!(array_get(p, 4))) { var vx = ((array_get(p, 0)) - (array_get(p, 2))) * argument1 var vy = ((array_get(p, 1)) - (array_get(p, 3))) * argument1 array_set(p, 2, array_get(p, 0)) array_set(p, 3, array_get(p, 1)) array_set(p, 0, ((array_get(p, 0)) + vx)) array_set(p, 1, ((array_get(p, 1)) + vy)) array_set(p, 1, ((array_get(p, 1)) + argument2)) } } }
(points, p_friction, p_gravity)
6
for (var i = 0; i < precision; i++)
7
    scr_verlet_updatesticks
scr_verlet_updatesticks

function scr_verlet_updatesticks(argument0) //gml_Script_scr_verlet_updatesticks { for (var i = 0; i < array_length(argument0); i++) { var s = array_get(argument0, i) var dx = (array_get(array_get(s, 1), 0)) - (array_get(array_get(s, 0), 0)) var dy = (array_get(array_get(s, 1), 1)) - (array_get(array_get(s, 0), 1)) var distance = sqrt(dx * dx + dy * dy) var difference = (array_get(s, 2)) - distance var percent = difference / distance / 2 var offsetX = dx * percent var offsetY = dy * percent if (!(array_get(array_get(s, 0), 4))) { array_set(array_get(s, 0), 0, ((array_get(array_get(s, 0), 0)) - offsetX)) array_set(array_get(s, 0), 1, ((array_get(array_get(s, 0), 1)) - offsetY)) } if (!(array_get(array_get(s, 1), 4))) { array_set(array_get(s, 1), 0, ((array_get(array_get(s, 1), 0)) + offsetX)) array_set(array_get(s, 1), 1, ((array_get(array_get(s, 1), 1)) + offsetY)) } } }
(sticks)
8
if can_move
9
{
10
    var wind_inc = 0.003
11
    wind_power = clamp((wind_power + wind_inc * wind_direction), (-wind_power_max), wind_power_max)
12
    if (wind_direction_change_countdown > 0)
13
    {
14
        if (abs(wind_power) == wind_power_max)
15
        {
16
            if (!alarm[0])
17
                alarm[0] = 15
alarm[0]

if live_call() return global.live_result; if (sway == 0) sway = sign(wind_power) * 0.03 else sway = 0 alarm[0] = 15
18
            wind_direction_change_countdown--
19
        }
20
        else
21
            alarm[0] = -1
alarm[0]

if live_call() return global.live_result; if (sway == 0) sway = sign(wind_power) * 0.03 else sway = 0 alarm[0] = 15
22
    }
23
    else
24
    {
25
        wind_direction_change_countdown = wind_direction_change_countdown_max
26
        wind_direction *= -1
27
    }
28
    for (i = 0; i < r_segments; i++)
29
        points[i][0] += (i * (wind_power + sway))
30
}
31
var col = false
32
for (i = 0; i < array_length(points); i++)
33
{
34
    var p = points[i]
35
    if (!p[4])
36
    {
37
        if position_meeting(p[0], p[1], obj_heart_battle_fighting_parent)
38
            col = true
39
    }
40
}
41
if (col == true && obj_heart_battle_fighting_parent.vulnerable == true && obj_heart_battle_fighting_parent.is_dashing == false)
42
{
43
    var damage = global.enemy_attack_stat - global.player_armor_defense - global.player_armor_modifier_defense - global.player_defense + 10
44
    with (obj_heart_battle_fighting_parent)
45
    {
46
        if (global.current_pp_self > 0)
47
        {
48
            instance_create(x, y, obj_heart_battle_effect_expand)
49
            for (i = 0; i < 5; i++)
50
                instance_create(x, y, obj_heart_battle_effect_shard)
51
            global.current_pp_self -= 1
52
            audio_play_sound(snd_mirrorbreak1, 20, false)
53
        }
54
        else
55
        {
56
            global.current_hp_self -= damage
57
            audio_play_sound(snd_hurt, 1, 0)
58
        }
59
        vulnerable = false
60
        global.hit_self = true
61
        alarm[0] = global.invulnerability_self
alarm[0]

if live_call() return global.live_result; if (sway == 0) sway = sign(wind_power) * 0.03 else sway = 0 alarm[0] = 15
62
    }
63
}