Advertisement
D0nyAlcap0ney

objPause step event code

Sep 30th, 2024
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Game Maker 3.84 KB | Source Code | 0 0
  1. ///objPause step event code
  2.  
  3.  
  4. if (global.previous_room == rmSequence1 or global.previous_room == rmSequence1Downstairs) {
  5.     global.cantrestart = true;
  6. } else {
  7.     global.cantrestart = false;
  8. }
  9. if wait>0 wait-=1
  10. if global.xbox=1 {
  11. if checkbutton(0,getid(5)) {
  12. if presstart=0 {
  13. presstart=1
  14. scrXboxPauseStart()
  15. }
  16. } else presstart=0
  17.  
  18. if checkbutton(0,getid(6)) {
  19. if pressback=0 {
  20. pressback=1
  21. scrXboxPauseBack()
  22. }
  23. } else pressback=0
  24.  
  25.  
  26. if leftthumb_y(0)>5000 {
  27. if pressup=0 {
  28. pressup=1
  29. scrXboxPauseUp()
  30. }
  31. } else pressup=0
  32.  
  33. if leftthumb_y(0)<-5000 {
  34. if pressdown=0 {
  35. pressdown=1
  36. scrXboxPauseDown()
  37. }
  38. } else pressdown=0
  39.  
  40. }
  41. if keyboard_check_pressed(ord(global.upkey)) event_perform(ev_keypress,ord('W'))
  42. if keyboard_check_pressed(ord(global.downkey)) event_perform(ev_keypress,ord('S'))
  43.  
  44. SteamRunCallbacks()
  45. if !surface_exists(global.surf1) {
  46. global.surf1=surface_create(room_width,room_height)
  47. surface_set_target(global.surf1)
  48. draw_clear_alpha(c_black,0)
  49. surface_reset_target()
  50. }
  51. surface_set_target(global.surf1)
  52. draw_clear_alpha(c_black,0)
  53. text="PAUSE"
  54. if on=1 {if textdir2<180 textdir2+=10} else {textdir2=blacky*180}
  55. if on=1 factor=0.5-lengthdir_x(0.5,textdir2) else {if factor>0 factor-=0.05 else {if on=2 {if !instance_exists(objPuzzle) instance_create(x,y,objPuzzle)}}}
  56. i=0
  57. draw_set_font(fntUnlock)
  58. draw_set_halign(fa_left)
  59. draw_set_valign(fa_center)
  60. start_x=view_wview[0]/2-string_width(text)*0.5
  61. repeat (string_length(text))*factor {
  62. letter=string_copy(text,1+i,1)
  63. ii=0
  64. repeat (5+lengthdir_x(4,textdir1+i*60)) {
  65. draw_set_color(merge_color(c_teal,c_white,ii*0.1))
  66. draw_text_transformed(start_x,room_height*0.35-ii*0.5,letter,1+ii*0.01,1+ii*0.01,0)
  67. ii+=1
  68. }
  69. start_x+=string_width(letter)
  70. i+=1
  71. }
  72. draw_set_font(fntMenu)
  73. i=0
  74. ii=0
  75. repeat (3) {
  76.   if select == i {
  77.     repeats = 6 + lengthdir_x(5, dir * 2);
  78.    
  79.     if on == 1 {
  80.         if frac(i * 0.5) > 0 addx = 260 * (1 - factor);
  81.         else addx = -260 * (1 - factor);
  82.     } else {
  83.         if frac(i * 0.5) > 0 addx = -260 * (1 - factor);
  84.         else addx = 260 * (1 - factor);
  85.     }
  86.  
  87.     repeat (repeats) {
  88.         // Check if the current option is the "restart" option (i == 1) and global.cantrestart is true
  89.         if global.cantrestart == true and i == 1 {
  90.             // Draw gray coloring over "Restart"
  91.             draw_set_color(c_dkgray);
  92.         } else {
  93.             // Apply the fuchsia and white merged color for all other cases
  94.             draw_set_color(merge_color(c_fuchsia, c_white, ii * 0.085));
  95.         }
  96.        
  97.         draw_text(room_width / 2 - 56 + ii + addx, room_height / 2 + i * 20, choice[i]);
  98.         ii += 1;
  99.     }
  100.     } else {
  101.         if on = 1 {
  102.             if frac(i * 0.5) > 0 addx = 260 * (1 - factor) else addx = -260 * (1 - factor)
  103.         } else {
  104.             if frac(i * 0.5) > 0 addx = -260 * (1 - factor) else addx = 260 * (1 - factor)
  105.         }
  106.  
  107.         amount = 0.5 + lengthdir_x(0.5, dir * 2);
  108.  
  109.         // Check if this is the "restart" option and grey it out if cantrestart is true
  110.         if global.cantrestart == true and i == 1 {
  111.             draw_set_color(c_dkgray); // Set grey color for the greyed-out option
  112.         } else {
  113.             draw_set_color(merge_color(c_white, c_aqua, amount));
  114.         }
  115.  
  116.         draw_text(room_width / 2 - 56 + 1 + addx, room_height / 2 + i * 20 + 1, choice[i]);
  117.         amount = 0.5 - lengthdir_x(0.5, dir * 2);
  118.        
  119.         // Reset color to normal if not greyed out
  120.         if global.cantrestart == true and i == 1 {
  121.             draw_set_color(c_dkgray); // Set grey color again for the main text
  122.         } else {
  123.             draw_set_color(merge_color(c_white, c_aqua, amount));
  124.         }
  125.  
  126.        draw_text(room_width / 2 - 56 + addx, room_height / 2 + i * 20, choice[i]);
  127.     }
  128.     i += 1;
  129. }
  130.  
  131.  
  132.  
  133. textdir1-=4
  134. surface_alpha()
  135. surface_reset_target()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement