Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_musicalbattlebullet_Step_0

(view raw script w/o annotations or w/e)
1
soundTimeStep = audio_sound_get_track_position(global.batmusic[1]);
2
var _prevBeats = beats;
3
beats = soundTimeStep / spb;
4
if (beats < _prevBeats)
5
    targetBeat -= beatMax;
6
framesAway = (targetBeat - beats) / bpf;
7
var _percent = max(0, framesAway / frames);
8
if (_percent > 0)
9
{
10
}
11
if (varianty > 0)
12
    varianty -= 5;
13
y = lerp(yTarget, ystart - varianty, _percent);
14
if (init == 1)
15
{
16
    if (abs(remFramesAway - framesAway) >= 4 && y >= 60)
17
    {
18
        active = 0;
19
        failed = 1;
20
    }
21
    remFramesAway = framesAway;
22
}
23
if (init == 0)
24
{
25
    remFramesAway = framesAway;
26
    init = 1;
27
}
28
if (failed == 1)
29
{
30
    image_alpha -= 0.1;
31
    if (image_alpha <= 0)
32
        instance_destroy();
33
}
34
if (_percent == 0 && failed == 0)
35
{
36
    instance_create_depth(x, y, depth + 1, obj_musicalbattlenote);
37
    snd_stop(instrument);
38
    snd_play(instrument);
39
    instance_destroy();
40
}