Advertisement
lalaladoomsday

Playtest Changelog Template by hyuponia

Mar 26th, 2023 (edited)
2,292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  2. //       Playtest Changelog Template by hyuponia. change the code as much you'd like
  3. //       please paste somewhere in "post_draw.gml"!
  4. //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  5. if (object_index == asset_get("oTestPlayer")){//this checks if it's in a playtest screen.
  6.     if (!variable_instance_exists(id,"pn__init")){//initialization part runs once
  7.         var i = 0;
  8.        
  9.         //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  10.         //       if you're just trying to put this on your character, change these variables!
  11.         //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  12.        
  13.         //IF YOUR TEXT HAS "" (quotes), REPLACE IT OR IT WILL BREAK!!! i usually replace them with '' (apostrophe)
  14.         //to make a new line, simply press enter. rivals' gml parser thing reads newline in string properly for some reason
  15.         //you can make as many entry as you want by copypasting
  16.         //  patch_note_title[i] = "";   and   patch_note_text[i++] = ""   like the example.
  17.         //no need to change the array number! (or rather, "i++" in this case), as it's incrementing itself each new text.
  18.         //the order you have in the code is how it'll be ordered in the list as well.
  19.         //
  20.         //i made it able to store multiple text but its probably recommended to only have a few in here
  21.         //like just for recent few patch notes maybe? but it's up to you how you use it!
  22.         //
  23.         //put text here.
  24.         patch_note_title[i] = "Title Text 1"
  25.         patch_note_text[i++] =
  26.         "Example text 1.
  27.         You make new lines like this!
  28.        
  29.         Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  30.        
  31.         patch_note_title[i] = "Title Text 2"
  32.         patch_note_text[i++] =
  33.         "Example text 2.
  34.         You make new lines like this!
  35.        
  36.         Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  37.        
  38.         patch_note_title[i] = "Title Text 3"
  39.         patch_note_text[i++] =
  40.         "Example text 3.
  41.         You make new lines like this!
  42.        
  43.         Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
  44.        
  45.        
  46.        
  47.         //these are optional things that you can change if you'd like, but probably best to keep as-is
  48.         pn__bg_col = make_colour_rgb( 0,0,0 ); //bg color.
  49.         pn__txt_col = make_colour_rgb( 255,255,255 ); //text color.
  50.         pn__acc_col = get_player_hud_color( player ); //accent color.
  51.         pn__btn_txt = "hold TAUNT: changelog"; //button text
  52.         pn__btn_width = 176; //button width in pixels, change it accordingly to text
  53.         pn__guide_txt = "use ATTACK / SPECIAL"; //select list guide text
  54.         pn__swipe_sound = asset_get("mfx_result_expand"); //sound for when changelog is opened/closed with taunt
  55.         pn__move_sound = asset_get("mfx_input_key"); //sound for moving between list entries
  56.         pn__confirm_sound = asset_get("mfx_forward"); //sound for confirming a list entry
  57.         pn__cancel_sound = asset_get("mfx_return_cursor"); //sound for cancelling out of a list entry
  58.         pn__scroll_speed = 3; //the speed of which how fast you scroll up/down in text display
  59.        
  60.         //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  61.         //*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*^+._.+^*
  62.        
  63.         //below are the actual patch note rendering and stuff.
  64.         //if you're not trying to do in-depth stuff, you dont have to touch these
  65.         //these are permanent variables just so we only have to run them once
  66.         //pn__ standing for Patch Note (double underscore cause i dont think anyone would do this, avoiding overlaps)
  67.         pn__init = true;
  68.         pn__list_select = 0;
  69.         pm__list_select_old = pn__list_select; //remember old selection for transition anim direction purposes
  70.         pn__list_max = i-1; //print(string(pn__list_max));
  71.         pn__taunt_track = 0; //after activated, checks if taunt has been unpressed before timer starts counting up again
  72.         pn__taunt_timer = 0; //track how long taunt is being held
  73.         pn__taunt_max = 50; //how long taunt should be held until its open
  74.         pn__open = false; //is it open or not
  75.         pn__opener_timer_max = 30; //opening timer max
  76.         pn__opener_timer = pn__opener_timer_max; //timer for opening
  77.         pn__displaying = false; //is it in the text screen (true) or in the list screen (false)
  78.         pn__scroll = 0; //current amount of scroll
  79.         pn__up_track = 0; //same with taunt track for list selection
  80.         pn__down_track = 0; //yes
  81.         pn__list_old = 0; //list selection storage
  82.         pn__select_timer_max = 16; //selection transition timer max
  83.         pn__select_timer = pn__select_timer_max; //selection transition timer
  84.         pn__scroll_did = 0; //niche storage for if list has scrolled or not
  85.             pn__online = false; //set
  86.         if (room == asset_get("network_char_select") || room == asset_get("workshop_room")){ //if in online playtest, or in extramode workshop list playtest
  87.             //thanks to mr nart for heads up on using asset_get for room id's instead!
  88.             pn__online = true; //switch to online view
  89.         }
  90.        
  91.     }
  92.     if (variable_instance_exists(id,"pn__init")){ //this is very unnecessary i just want to be safe to avoid error log
  93.         //the var's will omit the pn__ prefix because i dont think var's would interfere much with overlaps
  94.         //unless its in the same code, of course
  95.         //
  96.         //notes for self and for others:
  97.         //sprites with origin point at bottom will align with offline playtest screen bottom with
  98.         //clamp( (y + 61), 0, room_height-13 );
  99.         //update: accounting for room top, clamp( (y + 61), 209, room_height-13 );
  100.         //camera reaches the top at y 148, anything higher shifts the camera, so + 61, then 209
  101.         //playtest canvas is w 200 h 162 at 2x scale.
  102.         //css playtest is room 69
  103.         //extramode workshop list playtest is room 72  -  asset_get("workshop_room")
  104.         //online playtest is room 113  -  asset_get("network_char_select")
  105.        
  106.         var bc_x = clamp( x, 100, 860 );//i guess this is the "center", bottom center
  107.         var bc_y = clamp( (y + 61), 209, room_height-13 );//puzzles of math
  108.         var bc_yA = bc_y;//copy to preserve original for use as this one will be changed
  109.         var pn_bg = pn__bg_col; //it was long, will make it short. bg color.
  110.         var pn_txt = pn__txt_col; //text color.
  111.         var pn_acc = pn__acc_col; //text color.
  112.         var pn_i = pn__list_select; //selected entry.
  113.         var btn_wh = pn__btn_width/2; //button width but halved.
  114.         var page_h = 144 //page height
  115.         var pn_alpha = 0.8; //alpha
  116.         var a_str = draw_get_alpha(); //store the original alpha value to get back to once im done rendering, just in case
  117.        
  118.         // !!online values override!!
  119.         if (pn__online){//create online detection later
  120.             var bc_x = clamp( 120, 100, 860 );//i guess this is the "center", bottom center
  121.             var bc_y = clamp( (y + 111), 255, room_height-13 );
  122.             var bc_yA = bc_y;
  123.             var page_h = 190; //page height
  124.         }
  125.         var extendem = (pn__online)?260:0;
  126.        
  127.         //player freezer i hope
  128.         if (pn__open){ //(if open)
  129.             state = PS_SPAWN;
  130.             state_timer = 89;
  131.             hitpause = true; hitstop = 2; hitstop_full = 2;
  132.         }
  133.         //offset
  134.         if (pn__opener_timer<pn__opener_timer_max){
  135.             pn__opener_timer++;
  136.         }
  137.         if (pn__select_timer<pn__select_timer_max){
  138.             pn__select_timer++;
  139.         }
  140.         if (pn__open){ //(if opened)
  141.             var bc_yA = ease_expoOut( bc_yA-40, bc_y-page_h, pn__opener_timer, pn__opener_timer_max )
  142.         }else{ //(if closed)
  143.             var bc_yA = ease_expoOut( bc_y+40-page_h, bc_yA, pn__opener_timer, pn__opener_timer_max )
  144.         }
  145.        
  146.         //draw time
  147.        
  148.         draw_set_alpha(pn_alpha);
  149.         //bottom to top
  150.         var btn_wh_tmp = btn_wh+6;
  151.         draw_rectangle_colour( bc_x-btn_wh_tmp, bc_yA-1, bc_x+(btn_wh_tmp-1), bc_yA, pn_bg,pn_bg,pn_bg,pn_bg, false );
  152.         var btn_wh_tmp = btn_wh+2;
  153.         draw_rectangle_colour( bc_x-btn_wh_tmp, bc_yA-3, bc_x+(btn_wh_tmp-1), bc_yA-2, pn_bg,pn_bg,pn_bg,pn_bg, false );
  154.         draw_rectangle_colour( bc_x-btn_wh, bc_yA-13, bc_x+(btn_wh-1), bc_yA-4, pn_bg,pn_bg,pn_bg,pn_bg, false );
  155.         var btn_wh_tmp = btn_wh-2;
  156.         draw_rectangle_colour( bc_x-btn_wh_tmp, bc_yA-15, bc_x+(btn_wh_tmp-1), bc_yA-14, pn_bg,pn_bg,pn_bg,pn_bg, false );
  157.        
  158.         //this is like the page
  159.         draw_rectangle_colour( bc_x-100-(20*sign(extendem)), bc_yA+1, bc_x+99+extendem, bc_y+2, pn_bg,pn_bg,pn_bg,pn_bg, false );
  160.         draw_set_alpha(1);
  161.        
  162.         //button text button
  163.         draw_set_halign(fa_center); draw_set_valign(fa_bottom);
  164.         draw_set_font(asset_get("tinyFont"));
  165.         draw_text_ext_transformed_colour(bc_x+1, bc_yA-11, pn__btn_txt, 1, 800, 2, 2, 0, pn_txt, pn_txt, pn_txt, pn_txt, 1-(pn__open/2));
  166.        
  167.         //accent line
  168.         draw_set_alpha(0.6);
  169.         draw_rectangle_colour( bc_x-96-(20*sign(extendem)), bc_yA+5, bc_x+95+extendem, bc_yA+6, pn_acc,pn_acc,pn_acc,pn_acc, false );
  170.         draw_set_alpha(1);
  171.        
  172.         //txt alpha
  173.         if (pn__open){ //(if opened)
  174.             var txt_a = ease_expoOut( 0, 1, pn__opener_timer, pn__opener_timer_max )
  175.         }else{ //(if closed)
  176.             var txt_a = ease_expoOut( 1, 0, pn__opener_timer, pn__opener_timer_max )
  177.         }
  178.        
  179.        
  180.         if (pn__open){ //(if open)
  181.        
  182.         //the main page contents
  183.        
  184.         //list page
  185.         if (pn__displaying == false){
  186.            
  187.             //guide text
  188.             draw_set_valign(fa_top);
  189.             draw_text_ext_transformed_colour(bc_x+1, bc_yA+9, pn__guide_txt, 1, 800, 2, 2, 0, pn_txt, pn_txt, pn_txt, pn_txt, 1-(pn__open/2));
  190.             //txt set
  191.             draw_set_halign(fa_left); draw_set_valign(fa_top);
  192.             draw_set_font(asset_get("fName"));
  193.            
  194.                 //tthe lerp for l_off (list offset)
  195.                     var l_off_x = ease_cubeOut( -4, 2, pn__select_timer, pn__select_timer_max )
  196.                 if (pn__list_old == "up"){ //prev input is up
  197.                     var l_off_y = ease_cubeOut( 4, 0, pn__select_timer, pn__select_timer_max )
  198.                 }
  199.                 if (pn__list_old == "down"){ //prev input is down
  200.                     var l_off_y = ease_cubeOut( -4, 0, pn__select_timer, pn__select_timer_max )
  201.                 }
  202.            
  203.            
  204.             //time to draw the list page
  205.             if (pn__open){//scroll stuff n select stuff
  206.                 if (up_down){
  207.                     if (pn__up_track==false){
  208.                         pm__list_select_old = pn__list_select;  pn__list_select--;
  209.                         if (pn__list_select<0){pn__list_select = pn__list_max;}
  210.                         pn__up_track = true;
  211.                         pn__select_timer = 0;
  212.                         pn__list_old = "up"
  213.                         sound_play(pn__move_sound);
  214.                         pn__scroll_did = 0;
  215.                     }
  216.                 }else{ pn__up_track = false; };
  217.                 if (down_down){
  218.                     if (pn__down_track==false){
  219.                         pm__list_select_old = pn__list_select;  pn__list_select++;
  220.                         if (pn__list_select>pn__list_max){pn__list_select = 0;}
  221.                         pn__down_track = true;
  222.                         pn__select_timer = 0;
  223.                         pn__list_old = "down"
  224.                         sound_play(pn__move_sound);
  225.                         pn__scroll_did = 0;
  226.                     }
  227.                 }else{ pn__down_track = false; };
  228.                
  229.                 //list scroll stuff
  230.                 if ( ((pn_i*22)+26)+pn__scroll > page_h-20 ){//horrible puzzle of maths
  231.                     //print("true, down")
  232.                     pn__scroll = clamp( (pn_i*-22)+81, -9000, 0 );
  233.                     if (pn__online){ pn__scroll = clamp( (pn_i*-22)+132, -9000, 0 ); }
  234.                     pn__scroll_did = 2;
  235.                 }
  236.                 if ( ((pn_i*22)+26)+pn__scroll < 26 ){
  237.                     //print("true, up")
  238.                     pn__scroll = clamp( (pn_i*-22)+6, -9000, 0 );
  239.                     pn__scroll_did = 2;
  240.                 }
  241.                 //print(string(pn__scroll))
  242.                
  243.                 if (attack_down){
  244.                     pn__displaying = true;
  245.                     pn__scroll = 0;
  246.                     sound_play(pn__confirm_sound);
  247.                 }
  248.             }
  249.             for (var t = 0; t <= pn__list_max; t += 1){
  250.                 var x_off = (t==pn_i)?8+l_off_x:0;
  251.                 var y_off = (t==pn_i)?(t*22)+l_off_y:t*22;
  252.                 var y_loc = 26+pn__scroll-(l_off_y*pn__scroll_did);
  253.                 if (t==pn_i){
  254.                     var x_t_p = bc_x+l_off_x-89; //x triangle point
  255.                     var y_t_p = bc_yA+y_off+y_loc+5; //y triangle point
  256.                     draw_rectangle_colour( (x_t_p-1),   y_t_p,   (x_t_p),   y_t_p+1, pn_acc,pn_acc,pn_acc,pn_acc, false );
  257.                     draw_rectangle_colour( (x_t_p-1)-2, y_t_p-2, (x_t_p)-2, y_t_p+3, pn_acc,pn_acc,pn_acc,pn_acc, false );
  258.                     draw_rectangle_colour( (x_t_p-1)-4, y_t_p-4, (x_t_p)-4, y_t_p+5, pn_acc,pn_acc,pn_acc,pn_acc, false );
  259.                 };
  260.                 //title text!
  261.                 draw_text_ext_transformed_colour(bc_x-92+x_off, bc_yA+y_off+y_loc, patch_note_title[t], 16, -1, 1, 1, 0, pn_txt,pn_txt,pn_txt,pn_txt, txt_a);
  262.                 //divider line
  263.                 var c_tmp = (t==pn_i)?pn_acc:pn_txt;//color temp
  264.                 draw_set_alpha((t==pn_i)?1:0.3);
  265.                 draw_rectangle_colour( bc_x-96, bc_yA+y_off+y_loc+13, bc_x+95, bc_yA+y_off+y_loc+14, c_tmp,c_tmp,c_tmp,c_tmp, false );
  266.                 draw_set_alpha(1);
  267.             }
  268.            
  269.         }
  270.         if (pn__displaying == true){
  271.        
  272.         //txt set
  273.         draw_set_halign(fa_left); draw_set_valign(fa_top);
  274.         draw_set_font(asset_get("fName"));
  275.        
  276.         //time to draw changelog!!
  277.        
  278.         //text render is here!
  279.         if (pn__open){//scroll stuff
  280.             var scroll_max = ( string_height_ext(patch_note_text[pn_i], 16+(4*sign(extendem)), 190+extendem)-113 )*-1//thanks vman for finding this function
  281.             if (up_down){ pn__scroll+=pn__scroll_speed * (shield_down+1); } //hold shield to scroll faster
  282.             if (down_down){ pn__scroll-=pn__scroll_speed * (shield_down+1); }
  283.             pn__scroll = clamp( pn__scroll, scroll_max, 0 );
  284.             if (special_down){
  285.                 pn__displaying = false;
  286.                 pn__scroll = false;
  287.                 sound_play(pn__cancel_sound);
  288.             }
  289.         }
  290.         draw_text_ext_transformed_colour(bc_x-96, bc_yA+pn__scroll+12, patch_note_text[pn_i], 16+(4*sign(extendem)), 190+extendem, 1, 1, 0, pn_txt, pn_txt, pn_txt, pn_txt, txt_a);
  291.        
  292.         }//changelog over (if pn__displaying == true)
  293.         }//open check over
  294.        
  295.         //taunt hold meter
  296.         if (pn__taunt_timer>0){
  297.             var w_pr = ease_cubeIn( 2, pn__btn_width-2, round(pn__taunt_timer), pn__taunt_max );
  298.             draw_rectangle_colour( bc_x-btn_wh, bc_yA-1, (bc_x-btn_wh)+w_pr, bc_yA, pn_acc,pn_acc,pn_acc,pn_acc, false );
  299.             draw_set_alpha(1);
  300.         }
  301.        
  302.         //checks for taunt being held, or if it's in list view and special is being held
  303.         if (taunt_down || (pn__open && special_down && pn__displaying == false)){
  304.             if (pn__taunt_track == false){
  305.                 pn__taunt_timer++;
  306.                 if (pn__open){ pn__taunt_timer+=0.5; } //1.5x the speed when the panel is already open
  307.                 if (pn__taunt_timer > pn__taunt_max){
  308.                     pn__open = !pn__open; //this toggles it hopefully
  309.                     pn__taunt_track = true;
  310.                     pn__taunt_timer = 0;
  311.                     pn__opener_timer = 0;
  312.                     sound_play(pn__swipe_sound);
  313.                 }
  314.             }
  315.         }else{pn__taunt_track = false; pn__taunt_timer = 0; };
  316.        
  317.         //change it back
  318.         draw_set_alpha(a_str); draw_set_valign(fa_top); draw_set_halign(fa_center);
  319.     }
  320.    
  321.    
  322. }//testplay check over
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement