Guest User

Untitled

a guest
Apr 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.72 KB | None | 0 0
  1. #==============================================================================
  2. #  Scene_Credits
  3. #Author: Paul Baker, Midas Mike, and Unknown
  4. #Version: 2
  5. #           -Stopped when over
  6. #           -Added overlay
  7. #           -Added Cutscene Functionality
  8. #------------------------------------------------------------------------------
  9. #What you do is use $scene = Scene_Credits.new to
  10. #start scrolling the credits over the map screens.
  11. #the only functions that don't work are the ones
  12. #that involve messages, debug, battle, shop, menu,
  13. #save, or name changing screen.
  14. #The ones that do are
  15. #Teleporting, ScreenColor, and Audio playing.
  16. #==============================================================================
  17. module AMK_CREDITS
  18.   CREDITS_FONT = ["Trajan Pro"]
  19.   CREDITS_SIZE = 24
  20.   CREDITS_OUTLINE = Color.new(0,0,0,0)
  21.   CREDITS_SHADOW = Color.new(0,0,0, 100)
  22.   CREDITS_FILL = Color.new(255,255,255, 255)
  23.   CUTSCENE_ENABLED = true #Turns on and off map functionality
  24.   CANCEL_ENABLED = false #works if and only if Cutscene is disabled
  25.   OVERLAY_ENABLED = true #enables the overlay, works for both
  26. end
  27.  
  28. class Scene_Credits
  29. # This next piece of code is the credits.
  30. #Start Editing
  31. CREDIT=<<_END_
  32. Resident Evil - After History
  33.  
  34. Director
  35. ===============
  36. Felipe_9595
  37.  
  38.  
  39.  
  40.  
  41. Scripts
  42. ===============
  43. Nechigawara
  44. PinkMan(Particle System)
  45. Sylver(Particle System)
  46. markusmks(Particle System)
  47. Neo-Bahamut(Tileset Combiner)
  48. Near Fantastica(Antilag)
  49. Cogwheel(Pixel Movement)
  50. Myownfriend(Shutter Message)
  51. Dark_Wolf_Warrior(RMFlash)
  52. Ryex(Dinamic Sounds)
  53. Glitchfinder(Attract Mode)
  54.  
  55.  
  56.  
  57.  
  58. Graphics
  59. ===============
  60. Enterbrain::RTP
  61. Resident Evil 1
  62. Resident Evil 2
  63. Resident Evil 3
  64. Felipe_9595
  65.  
  66.  
  67.  
  68.  
  69. Spriters
  70. ===============
  71. StarSkipping
  72. Felipe_9595
  73.  
  74.  
  75. Songs
  76. ===============
  77. Resident Evil 1 OST
  78. Resident Evil 2 OST
  79. Resident Evil 3 OST
  80. Resident Evil Remake OST
  81. Final Fantasy Tactics A2 OST
  82.  
  83.  
  84.  
  85.  
  86.  
  87. Maping
  88. ===============
  89. Felipe_9595
  90.  
  91.  
  92.  
  93.  
  94. Eventing
  95. ===============
  96. Felipe_9595
  97.  
  98.  
  99.  
  100.  
  101. Main Translator
  102. ===============
  103. RpgManiac3030
  104.  
  105.  
  106.  
  107.  
  108. Secondary Translator
  109. ===============
  110. Felipe_9595
  111.  
  112.  
  113.  
  114.  
  115. Thanks to
  116. ===============
  117. Nechigawara
  118. Jonathan
  119. Soul-Maker.com
  120. Mundo-Maker
  121. And a lot of other people who made this possible
  122.  
  123.  
  124. End of the Demo
  125.  
  126.  
  127. _END_
  128. #Stop Editing
  129.  
  130.   def main
  131.     if !AMK_CREDITS::CUTSCENE_ENABLED
  132.       $game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
  133.     end
  134.          
  135.     #Scene Map instances
  136.     @spriteset = Spriteset_Map.new
  137.    
  138.     #-------------------------------
  139.     # Animated Background Setup
  140.     #-------------------------------
  141.     @sprite = Sprite.new
  142.     @backgroundGameFrameCount = 0
  143.     @backgroundG_BFrameCount = 3.4
  144.    
  145.     #-------------------------------
  146.     # Credits Overlay Setup
  147.     #-------------------------------
  148.     if AMK_CREDITS::OVERLAY_ENABLED
  149.       @overlay = Sprite.new
  150.       @overlay.bitmap = RPG::Cache.picture("Credits_Overlay")
  151.       @overlay.x = 0
  152.       @overlay.y = 0
  153.       @overlay.z = 1000
  154.     end
  155.        
  156.     #------------------
  157.     # Credits txt Setup
  158.     #------------------
  159.     credit_lines = CREDIT.split(/\n/)
  160.     credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
  161.     credit_lines.each_index do |i|
  162.       line = credit_lines[i]
  163.       credit_bitmap.font.name = AMK_CREDITS::CREDITS_FONT
  164.       credit_bitmap.font.size = AMK_CREDITS::CREDITS_SIZE
  165.       x = 0
  166.       credit_bitmap.font.color = AMK_CREDITS::CREDITS_OUTLINE
  167.       credit_bitmap.draw_text(0 + 1,i * 32 + 1,640,32,line,1)
  168.       credit_bitmap.draw_text(0 - 1,i * 32 + 1,640,32,line,1)
  169.       credit_bitmap.draw_text(0 + 1,i * 32 - 1,640,32,line,1)
  170.       credit_bitmap.draw_text(0 - 1,i * 32 - 1,640,32,line,1)
  171.       credit_bitmap.font.color = AMK_CREDITS::CREDITS_SHADOW
  172.       credit_bitmap.draw_text(0,i * 32 + 8,640,32,line,1)
  173.       credit_bitmap.font.color = AMK_CREDITS::CREDITS_FILL
  174.       credit_bitmap.draw_text(0,i * 32,640,32,line,1)
  175.     end
  176.     @credit_sprite = Sprite.new(Viewport.new(0,50,640,380))
  177.     @credit_sprite.bitmap = credit_bitmap
  178.     @credit_sprite.z = 9998
  179.     @credit_sprite.oy = -430 #-430
  180.     @frame_index = 0
  181.     @last_flag = false
  182.    
  183.     #--------
  184.     # Audio Setup
  185.     #--------
  186.     Audio.me_stop
  187.     Audio.bgs_stop
  188.     Audio.se_stop
  189.    
  190.     Graphics.transition
  191.    
  192.     loop do
  193.      
  194.       Graphics.update
  195.       Input.update
  196.       update
  197.       # if the scene is changed
  198.       if $scene != self
  199.         break
  200.       end
  201.     end
  202.     # disposes the sprites
  203.     Graphics.freeze
  204.     @spriteset.dispose
  205.     #@message_window.dispose
  206.     @sprite.dispose
  207.     if AMK_CREDITS::OVERLAY_ENABLED
  208.       @overlay.dispose
  209.     end
  210.     @credit_sprite.dispose
  211.   end
  212.  
  213.   ##Checks if credits bitmap has reached it's ending point
  214.   def last?
  215.     if @frame_index > (@credit_sprite.bitmap.height + 500)
  216.       Audio.bgm_fade(10000) #aprox 10 seconds
  217.       $game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
  218.       $scene = Scene_Save_End.new
  219.       return true
  220.     end
  221.     return false
  222.   end
  223.   ##Checks if player can cancel the credits
  224.   def cancel?
  225.     if Input.trigger?(Input::C) || Input.trigger?(Input::B) and AMK_CREDITS::CANCEL_ENABLED
  226.       Audio.bgm_fade(10000) #aprox 10 seconds
  227.       $game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 20)
  228.       $scene = Scene_Save_End.new
  229.       return true
  230.     end
  231.     return false
  232.   end
  233.  
  234.   #--------------------------------------------------------------------------
  235.   # Updates the scene
  236.   #--------------------------------------------------------------------------
  237.   def update
  238.     @backgroundGameFrameCount = @backgroundGameFrameCount + 1
  239.     if @backgroundGameFrameCount >= @backgroundG_BFrameCount
  240.       @backgroundGameFrameCount = 0
  241.       # Add current background frame to the end
  242.       # and drop it from the first position
  243.     end
  244.     return if cancel?
  245.     return if last?
  246.     @credit_sprite.oy += 1 #this is the speed that the text scrolls. 1 is default
  247.     #The fastest I'd recomend is 5, after that it gets hard to read.
  248.     @frame_index += 1 #This should fix the non-self-ending credits
  249.  
  250.     #Scene Map Instances
  251.     loop do
  252.       $game_map.update
  253.       $game_system.map_interpreter.update
  254.       #$game_player.update #character movement
  255.       $game_system.update
  256.       $game_screen.update
  257.       unless $game_temp.player_transferring
  258.         break
  259.       end
  260.       transfer_player
  261.       if $game_temp.transition_processing
  262.         break
  263.       end
  264.     end
  265.     @spriteset.update
  266.     #@message_window.update
  267.     if $game_temp.transition_processing
  268.       $game_temp.transition_processing = false
  269.       if $game_temp.transition_name == ""
  270.         Graphics.transition(20)
  271.       else
  272.         Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name)
  273.       end
  274.     end
  275.     def transfer_player
  276.       $game_temp.player_transferring = false
  277.       if $game_map.map_id != $game_temp.player_new_map_id
  278.         $game_map.setup($game_temp.player_new_map_id)
  279.       end
  280.       $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  281.       case $game_temp.player_new_direction
  282.       when 2  # down
  283.         $game_player.turn_down
  284.       when 4  # left
  285.         $game_player.turn_left
  286.       when 6  # right
  287.         $game_player.turn_right
  288.       when 8  # up
  289.         $game_player.turn_up
  290.       end
  291.       $game_player.straighten
  292.       $game_map.update
  293.       @spriteset.dispose
  294.       @spriteset = Spriteset_Map.new
  295.       if $game_temp.transition_processing
  296.         $game_temp.transition_processing = false
  297.         Graphics.transition(20)
  298.       end
  299.       #$game_map.autoplay #disabled so music won't change when the map does.
  300.       Graphics.frame_reset
  301.       Input.update
  302.     end
  303.   end
  304.  
  305. end #Ends the scene
Add Comment
Please, Sign In to add comment