Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_ball_Step_0

(view raw script w/o annotations or w/e)
1
var _width = 50 + (obj_mike_controller.line_width / 2) + (obj_mike_controller.hand_distance / 2);
2
vspeed = clamp(vspeed, -12, 6 + min(3, max(0, obj_mike_attack_controller.difficulty - 3)));
3
x = clamp(x, (room_width / 2) - _width, (room_width / 2) + _width);
4
var _o = collision_circle(x, y, 10, obj_mike_ball, 1, 1);
5
if (_o)
6
{
7
    if (_o.sprite_index == sprite_index)
8
    {
9
        wobble = 4;
10
        x += lengthdir_x(1, point_direction(_o.x, _o.y, x, y));
11
        y += lengthdir_y(1, point_direction(_o.x, _o.y, x, y));
12
    }
13
}
14
if (act == 0)
15
{
16
    gravity = lerp(gravity, 1, 0.01);
17
    hspeed *= 0.99;
18
}
19
if (act == 1)
20
{
21
    if (y < cameray())
22
        vspeed *= 0.5;
23
    if (y < (cameray() + 120))
24
    {
25
        vspeed *= 0.95;
26
        hspeed *= 0.99;
27
        if (vspeed == 0)
28
        {
29
            gravity = 0.1;
30
            alarm[0]
 = -1;
gml_Object_obj_mike_ball_Alarm_0.gml

if (act == 1) act = 0;
31
            act = 0;
32
        }
33
    }
34
}
35
if (act == 2)
36
{
37
    gravity = 1;
38
    gravity_direction = 90;
39
    if (y < -32)
40
        instance_destroy();
41
}
42
if (y > room_height)
43
{
44
    
scr_sparkle
scr_sparkle

function
scr_sparkle(arg0)
{ var num = arg0; dir = irandom(360); for (i = 0; i < num; i++) { var _ob = instance_create_depth(x + lengthdir_x(16, dir + ((i / num) * 360)), y + lengthdir_y(16, dir + ((i / num) * 360)), depth - 1, obj_heart_sparkle); _ob.speed = 4; _ob.direction = (i / num) * 360; } } function scr_sparkle_pos(arg0, arg1, arg2) { var num = arg0; dir = irandom(360); for (i = 0; i < num; i++) { var _ob = instance_create_depth(arg1 + lengthdir_x(16, dir + ((i / num) * 360)), arg2 + lengthdir_y(16, dir + ((i / num) * 360)), depth - 1, obj_heart_sparkle); _ob.speed = 4; _ob.direction = (i / num) * 360; } } function scr_sparkle_colour(arg0, arg1) { var num = arg0; dir = 0; for (i = 0; i < num; i++) { var _ob = instance_create_depth(x + lengthdir_x(16, dir + ((i / num) * 360)), y + lengthdir_y(16, dir + ((i / num) * 360)), depth - 5, obj_heart_sparkle); _ob.speed = 4; _ob.direction = (i / num) * 360; _ob.image_blend = arg1; } } function scr_sparkle_random(arg0) { var num = arg0; dir = irandom(360); for (i = 0; i < num; i++) { with (instance_create_depth(x + lengthdir_x(16, (i / num) * 360), y + lengthdir_y(16, (i / num) * 360), depth - 1, obj_heart_sparkle)) motion_set(other.dir, irandom_range(4, 6)); dir += irandom(30); } }
(8);
45
    with (obj_mike_minigame_controller)
46
        game_over = true;
47
    instance_destroy();
48
}