Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_beatbullet_2

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

function scr_beatbullet_2() { var _frames = argument[1]; var _targetBeat = argument[2]; var _yTop = cameray(); var _yBottom = _yTop + 450; var _loopOffset = argument[6] + 2; var _fadeInFrames = 15; if (argument_count > 7) _yTop = argument[7]; if (argument_count > 8) _yBottom = argument[8]; if (argument_count > 9) _fadeInFrames = argument[9]; var _horizontal = false; if (argument_count > 10) _horizontal = argument[10]; var _bullet; if (!_horizontal) _bullet = instance_create_depth(argument[0], _yTop, 0, obj_beatbullet_2); else _bullet = instance_create_depth(_yTop, argument[0], 0, obj_beatbullet_2); with (_bullet) { horizontal = _horizontal; if (horizontal) image_angle = 90; endY = _yBottom; targetX = argument[0]; follow = argument[4]; bpm = argument[3]; framesAway = 999; frames = _frames; fadeSpeed = _fadeInFrames; 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]); var _length = audio_sound_length(global.currentsong[1]); beats = soundTimeStep / spb; beatMax = _length / spb; beatsPrev = beats; looping = argument[5]; beatLoop = _targetBeat; loopOffset = _loopOffset; if (looping == 0) targetBeat = _targetBeat; else targetBeat = (ceil(beats / looping) * looping) + _targetBeat + _loopOffset; inSync = true; } else { beatMax = 9999; loopOffset = _loopOffset; looping = argument[5]; beatLoop = _targetBeat; targetBeat = _targetBeat + loopOffset; inSync = false; } } return _bullet; }
()
2
{
3
    var _frames = argument[1];
4
    var _targetBeat = argument[2];
5
    var _yTop = cameray();
6
    var _yBottom = _yTop + 450;
7
    var _loopOffset = argument[6] + 2;
8
    var _fadeInFrames = 15;
9
    if (argument_count > 7)
10
        _yTop = argument[7];
11
    if (argument_count > 8)
12
        _yBottom = argument[8];
13
    if (argument_count > 9)
14
        _fadeInFrames = argument[9];
15
    var _horizontal = false;
16
    if (argument_count > 10)
17
        _horizontal = argument[10];
18
    var _bullet;
19
    if (!_horizontal)
20
        _bullet = instance_create_depth(argument[0], _yTop, 0, obj_beatbullet_2);
21
    else
22
        _bullet = instance_create_depth(_yTop, argument[0], 0, obj_beatbullet_2);
23
    with (_bullet)
24
    {
25
        horizontal = _horizontal;
26
        if (horizontal)
27
            image_angle = 90;
28
        endY = _yBottom;
29
        targetX = argument[0];
30
        follow = argument[4];
31
        bpm = argument[3];
32
        framesAway = 999;
33
        frames = _frames;
34
        fadeSpeed = _fadeInFrames;
35
        image_alpha = 0;
36
        bps = bpm / 60;
37
        spb = 1 / bps;
38
        bpf = bps / game_get_speed(gamespeed_fps);
39
        if (snd_is_playing(global.currentsong[1]))
40
        {
41
            soundTimeStep = audio_sound_get_track_position(global.currentsong[1]);
42
            var _length = audio_sound_length(global.currentsong[1]);
43
            beats = soundTimeStep / spb;
44
            beatMax = _length / spb;
45
            beatsPrev = beats;
46
            looping = argument[5];
47
            beatLoop = _targetBeat;
48
            loopOffset = _loopOffset;
49
            if (looping == 0)
50
                targetBeat = _targetBeat;
51
            else
52
                targetBeat = (ceil(beats / looping) * looping) + _targetBeat + _loopOffset;
53
            inSync = true;
54
        }
55
        else
56
        {
57
            beatMax = 9999;
58
            loopOffset = _loopOffset;
59
            looping = argument[5];
60
            beatLoop = _targetBeat;
61
            targetBeat = _targetBeat + loopOffset;
62
            inSync = false;
63
        }
64
    }
65
    return _bullet;
66
}