Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_beatbulletroomexample_Create_0

(view raw script w/o annotations or w/e)
1
bpm = 117;
2
bps = bpm / 60;
3
spb = 1 / bps;
4
bpf = bps / game_get_speed(gamespeed_fps);
5
beat = 0;
6
active = false;
7
specialsSetup = false;
8
safeAreaLeft = 300;
9
safeAreaRight = room_width - safeAreaLeft;
10
lanesSeparation = 200;
11
newBulletsEvery = 4;
12
lanesCount = room_width div lanesSeparation;
13
snd_free(global.currentsong[0]);
14
mus_initloop("cyber.ogg");
15
for (var i = 0; i < lanesCount; i++)
16
{
17
    var _xx = i * lanesSeparation;
18
    if (_xx > safeAreaLeft && _xx < safeAreaRight)
19
    {
20
        if (i % 2)
21
            
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; }
(_xx, 30, 2, bpm, -4, true, 0, 50, 400);
22
        else
23
            
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; }
(_xx, 30, 2, bpm, -4, true, 1, 50, 400);
24
    }
25
}