Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To learn more about this code, watch my video:
- https://www.youtube.com/watch?v=0ekoEYnqAe4
- */
- /*
- ================================================
- =================Objects========================
- ================================================
- */
- /*
- ================================================
- =================obj_alert======================
- ================================================
- */
- //Create Event
- alert_title = "Alert";
- alert_description = "You broke something, please report to developer.";
- can_destroy = false;
- alarm[0] = 10;
- //Alarm0 Event
- can_destroy = true;
- //Draw Event
- draw_set_color(c_white);
- draw_set_halign( fa_center );
- draw_set_valign( fa_middle );
- //Draw Base Box
- draw_rectangle( responsive_x(.5), responsive_y( 4 ), responsive_x( 11.5 ), responsive_y(4)+100, false );
- //Set up a breakpoint
- var _bp = 0;
- if( camera_get_view_width(view_camera[view_current]) < 300 ){
- _bp = -.1;
- }
- //Draw the content
- draw_set_color( c_black);
- draw_line_width( responsive_x( .5 )-1, responsive_y(4.8), responsive_x( 11.5 ), responsive_y(4.8), 3 );
- responsive_text( responsive_x( 6 ), responsive_y( 4 )+15, alert_title, responsive_y(.5 + _bp), responsive_x(10), c_black );
- responsive_text( responsive_x( 6 ), responsive_y( 4 )+50, alert_description, responsive_y(.4 + _bp), responsive_x(10), c_black );
- responsive_text( responsive_x( 6 ), responsive_y( 4 )+85, "Press any key to continue", responsive_y(.4 + _bp), responsive_x(10), c_black );
- draw_set_color( -1 );
- draw_set_halign( -1 );
- draw_set_valign( -1 );
- //Key Press Any Event
- if( can_destroy ){
- instance_destroy();
- }
- /*
- ================================================
- =================Scripts========================
- ================================================
- */
- /*
- ===================================================
- =================responsive_x======================
- ===================================================
- */
- ///@description Get the x value at the width fraction, 12 base.
- ///@param fraction 1-12 as to what fraction to use.
- var scrn_w = camera_get_view_width(view_camera[view_current ]);//Screen width
- var scrn_x = camera_get_view_x(view_camera[view_current]);
- var scrn_fract = scrn_w / 12;
- return scrn_x + (scrn_fract * argument[0]);
- /*
- ===================================================
- =================responsive_y======================
- ===================================================
- */
- ///@description Get the y value at the height fraction, 12 base.
- ///@param fraction 1-12 as to what fraction to use.
- var scrn_h = camera_get_view_height(view_camera[view_current]);//Screen width
- var scrn_y = camera_get_view_y(view_camera[view_current]);
- var scrn_fract = scrn_h / 12;
- return scrn_y + (scrn_fract * argument[0]);
- /*
- ======================================================
- =================responsive_text======================
- ======================================================
- */
- ///@description Using this script draw text that dynamically scales with the screen
- ///@param X The x position of the text
- ///@param Y The y position of the text
- ///@param Text The string position of the text
- ///@param heightPerLine The height in pixels to scale the text to, per line
- ///@param width The width in pixels to restrain the text to
- ///@param color The color of the text
- var _width = camera_get_view_width(view_camera[view_current]);
- var _str_height = string_height(argument[2]);
- var _scale = argument[3]/_str_height;
- var _sep = _str_height;
- draw_text_ext_transformed_color(
- argument[0],
- argument[1],
- argument[2],
- _sep,
- argument[4] / _scale,
- _scale,
- _scale,
- 0,
- argument[5],
- argument[5],
- argument[5],
- argument[5],
- 1
- );
- /*
- ================================================
- =================scr_alert======================
- ================================================
- */
- ///@description Create an alert message, companion to obj_alert
- ///@param Message The message to show in the alert
- ///@param *Title Optionally, modify the title
- show_debug_message( "===scr_alert: Initating Message: " + argument[0] );
- var title = "";
- if( argument_count > 1 ){
- title = argument[1];
- }
- if( !instance_exists( obj_alert ) ){
- var messagebox = instance_create_depth(0,0,0, obj_alert);
- if( title != "" ) messagebox.alert_title = argument[1];
- messagebox.alert_description = argument[0];
- }else{
- show_debug_message( "===scr_alert: Message already running!" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement