Fields of Mistria — Vanilla GML Reference FoM v1.0.8

obj_dungeon_ladder_down.gml

object_create(
    "obj_dungeon_ladder_down",
    object_reserve("par_ladder"),
    {
        sprite_index: spr_main_dungeon_prototype_instance_door_ladder_down,
        state: LadderState.Spawned,
        create: function() {
            event_inherit(ObjectEvent.Create);
            self.xstart = self.x;
            self.ystart = self.y;
            self.bounce_y_offset = -11;
            self.use_interact_bubble(spr_ui_bark_icon_ladder, spr_ui_bark_icon_ladder_small);

            function bubble_should_update() {
                if MIST.running {
                    return;
                }

                self.bouncer.status = InteractBounceStatus.Distant;
                self.bouncer.alpha = approach(self.bouncer.alpha, BARK_MIN_ALPHA, BARK_FADE_SPEED);
            }
        },
        step: function() {
            //
            if self.want_to_spawn_collision {
                var ox = self.xstart div 8;
                var oy = self.ystart div 8;

                if collision_rectangle(ox * 8, oy * 8, ox * 8 + 16, oy * 8 + 16, obj_ari) == undefined {
                    var jumpable = self.object_index != obj_dungeon_ladder_up;
                    set_collision_on_node_region(GRID, ox, oy, ox + 1, oy + 1, jumpable);

                    self.want_to_spawn_collision = false;
                }
            }
        },
    }
);