Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_beatbullet

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

function scr_beatbullet() { var _frames = argument[1]; var _targetBeat = argument[2]; var _yTop = cameray(); var _yBottom = _yTop + 450; if (argument_count > 5) _yTop = argument[5]; if (argument_count > 6) _yBottom = argument[6]; with (instance_create_depth(argument[0], _yTop, 0, obj_beatbullet)) { endY = _yBottom; targetX = argument[0]; follow = argument[4]; bpm = argument[3]; framesAway = 999; frames = _frames; image_alpha = 0; bps = bpm / 60; spb = 1 / bps; bpf = bps / game_get_speed(gamespeed_fps); if (snd_is_playing(global.currentsong[1])) { soundTimeStep = audio_sound_get_track_position(global.currentsong[1]); beats = soundTimeStep / spb; beatsPrev = beats; targetBeat = floor(beats + _targetBeat); inSync = true; } else { targetBeat = _targetBeat; inSync = false; } } }
()
2
{
3
    var _frames = argument[1];
4
    var _targetBeat = argument[2];
5
    var _yTop = cameray();
6
    var _yBottom = _yTop + 450;
7
    if (argument_count > 5)
8
        _yTop = argument[5];
9
    if (argument_count > 6)
10
        _yBottom = argument[6];
11
    with (instance_create_depth(argument[0], _yTop, 0, obj_beatbullet))
12
    {
13
        endY = _yBottom;
14
        targetX = argument[0];
15
        follow = argument[4];
16
        bpm = argument[3];
17
        framesAway = 999;
18
        frames = _frames;
19
        image_alpha = 0;
20
        bps = bpm / 60;
21
        spb = 1 / bps;
22
        bpf = bps / game_get_speed(gamespeed_fps);
23
        if (snd_is_playing(global.currentsong[1]))
24
        {
25
            soundTimeStep = audio_sound_get_track_position(global.currentsong[1]);
26
            beats = soundTimeStep / spb;
27
            beatsPrev = beats;
28
            targetBeat = floor(beats + _targetBeat);
29
            inSync = true;
30
        }
31
        else
32
        {
33
            targetBeat = _targetBeat;
34
            inSync = false;
35
        }
36
    }
37
}