obj_renown_chest.gml
object_create(
"obj_renown_chest",
object_reserve("par_ledger"),
{
sprite_index: spr_town_renown_chest_spring_closed,
create: function() {
depth = get_instance_depth(y);
event_inherit(ObjectEvent.Create);
//
SHADOW_GRID.caster_create(self);
self.setup_offsets("renown_chest");
self.bubble_icon_big = spr_ui_bark_icon_gift;
self.bubble_icon_small = spr_ui_bark_icon_gift_small;
function bubble_should_update() {
if menu_or_cutscene_pause() || RENOWN_REWARD_INVENTORY.is_empty() {
return;
}
//
self.bouncer.alpha = BARK_MIN_ALPHA;
self.bouncer.status = InteractBounceStatus.Distant;
var target = distance_to_ari_interactable() < STANDARD_INTERACTION_DISTANCE ? BARK_MIN_ALPHA : 0;
self.bouncer.alpha = approach(self.bouncer.alpha, target, BARK_FADE_SPEED);
}
self.register_interaction(
InputId.Interact,
"misc_local/collect_rewards",
function() {
ANCHOR.spawn_menu(Menu.RenownChest);
self.sprite_index = spr_town_renown_chest_spring_opening;
},
function() {
return !RENOWN_REWARD_INVENTORY.is_empty();
}
);
},
step: function() {
if ANCHOR.get_menu(Menu.RenownChest) == undefined
&& self.sprite_index == spr_town_renown_chest_spring_opened
{
self.sprite_index = spr_town_renown_chest_spring_opening;
self.image_speed = -1;
}
},
animation_end: function() {
if self.sprite_index == spr_town_renown_chest_spring_opening {
if self.image_speed == 1.0 {
self.sprite_index = spr_town_renown_chest_spring_opened;
} else {
self.sprite_index = spr_town_renown_chest_spring_closed;
}
self.image_speed = 1.0;
}
},
}
);