Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------------------------------------------
- /// @function notifications_process_system()
- /// @description update notifications every step
- // Loop through notificationss
- var _y_target = y_notification;
- var _size = ds_list_size(notifications_list);
- for (var i = 0; i < _size; i++)
- {
- var _notifications = notifications_list[| i];
- // Move this notifications
- _y_target = _y_target - _new_notification[? "height"];
- _notifications[? "y"] = lerp(_notifications[? "y"], _y_target, 0.25);
- _notifications[? "timer"]-= 1 + i * 2;
- // Handle this notifications's exit
- if ( _notifications[? "timer"] <= 0 )
- {
- _notifications[? "alpha"] -= 0.05;
- if ( _notifications[? "alpha"] < 0.1 )
- {
- // Destroy this notifications
- ds_list_delete(notifications_list, i);
- ds_map_destroy(_notifications);
- // Adjust iteration
- --i;
- --_size;
- }
- }
- }
- ------------------------------------------------------------------------------------------------------------------
- ///@function notifications_add_item(text, timer)
- /// @description add a message to the list of notifications
- /// @param text
- /// @param timer
- var _text = argument[0];
- if ( argument_count > 1 ) _timer = argument[1];
- else _timer = 240;
- var _height = string_height_ext(_text, -1, _notifications_width);
- with ( NOTIFICATOR )
- {
- var _new_notification = ds_map_create();
- _new_notification[? "text"] = _text;
- _new_notification[? "height"] = _height;
- _new_notification[? "y"] = notifications_y + _height;
- _new_notification[? "alpha"] = 1;
- _new_notification[? "timer"] = _timer;
- ds_list_insert(notifications_list, 0, _new_notification);
- }
Advertisement
Add Comment
Please, Sign In to add comment