IceDragon200

Title Mix

Oct 8th, 2011
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.96 KB | None | 0 0
  1. #=========================================================#
  2. # Rafidelis KáHh Box Title                                #
  3. # Por: Rafidelis                                          #
  4. # Data: 03/01/09                                          #
  5. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  6. # Creditos : KahH por fazer a versão por Eventos para o   #
  7. # Rpg Maker XP. Vlw KahH,bjs pra vc^^                     #
  8. #=========================================================#
  9.  
  10. #=========================================================#
  11. # Instruções:                                             #
  12. #---------------------------------------------------------#
  13. # Colar acima do main,e editar o modulo Rafidelis.        #
  14. # As imagens que servirão como opções no title,devem ter  #
  15. # tamanho de 81 x 380 px para não ocasionar em erros.     #
  16. #=========~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=============#
  17.  
  18.  
  19. #=============================================
  20. #   INICIO DAS CONFIGURAÇÕES
  21. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. module Rafidelis
  23.   PIC_NAMES =
  24.   [
  25.   "I1",     # Nome da Imagem de novo jogo
  26.   "I2",     # Nome da Imagem de load game
  27.   "I3",     # Nome da Imagem de Extra
  28.   "I4",     # Nome da Imagem de Options
  29.   "I5",     # Nome da Imagem de Exit (Sair)
  30.   "I6",     # Nome da Imagem de Creditos
  31.   "BG",     # Nome da Imagem de fundo
  32.   "Credits" # Nome da Imagem da Imagem de Creditos
  33.   ]
  34.  
  35.   BOX_PIC_FINAL_OPACITY = 200    # Opacidade Final das imagens de Opções
  36.   BG_FINAL_OPACITY = 200         # Opacidade Final da imagem de background
  37. #=============================================
  38. #   FIM DAS CONFIGURAÇÕES
  39. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. end
  41.  
  42. # // <Icy Title Graphics>
  43. module TitleGraphics
  44.  
  45.   INDEX_MAP = {}
  46. # INDEX_MAP[command_index] = "Filename"
  47.   INDEX_MAP[0] = "" # // New Game
  48.   INDEX_MAP[1] = "" # // Continue
  49.   INDEX_MAP[2] = "" # // ??????
  50.   INDEX_MAP[3] = "" # // Shutdown
  51.  
  52.   FADE_RATE = 60.0
  53.  
  54.   def tg_create_title_graphics()
  55.     @sprites = []
  56.     for i in 0...INDEX_MAP.keys.size
  57.       @sprites[i] = Sprite.new()
  58.       @sprites[i].bitmap = Cache.system( INDEX_MAP[i] )
  59.     end
  60.     @sprite = @sprites[0]
  61.   end
  62.  
  63.   def tg_update_title_graphics()
  64.     @sprite = @sprites[@command_window.index]
  65.     for sp in @sprites
  66.       sp.opacity -= 255 / FADE_RATE unless sp == @sprite
  67.     end
  68.     @sprite.opacity += 255 / FADE_RATE
  69.   end
  70.  
  71.   def tg_dispose_title_graphics()
  72.     @sprites.each { |sp| sp.bitmap.dispose() ; sp.dispose() } ; @sprite = nil
  73.   end
  74.  
  75. end
  76.  
  77. class Scene_Title < Scene_Base
  78.  
  79.   include TitleGraphics
  80.  
  81.   def create_title_graphic()
  82.     tg_create_title_graphics()
  83.     @sprite = @sprites[0]
  84.   end
  85.  
  86.   def dispose_title_graphic()
  87.     tg_dispose_title_graphics()
  88.   end
  89.  
  90. end
  91. # // </Icy Title Graphics>
  92.  
  93. class Scene_Title < Scene_Base
  94.  
  95.   include Rafidelis
  96.  
  97.   alias rafidelis_kaHh_box_title_start start unless $@
  98.   def start()
  99.     rafidelis_kaHh_box_title_start()
  100.   #==========================#
  101.   #   Declarando os Sprites  #
  102.   #==========================#
  103.     @newgame = Sprite.new
  104.     @continue = Sprite.new
  105.     @credits = Sprite.new
  106.     @exit = Sprite.new
  107.     @background = Sprite.new
  108.   #==========================#
  109.   #    Criando as Imagens    #
  110.   #==========================#
  111.     @newgame.bitmap = Cache.picture(PIC_NAMES[0])
  112.     @continue.bitmap = Cache.picture(PIC_NAMES[1])
  113.     @exit.bitmap = Cache.picture(PIC_NAMES[4])
  114.     @credits.bitmap = Cache.picture(PIC_NAMES[5])
  115.     @background.bitmap = Cache.picture(PIC_NAMES[6])
  116.     @background.z = @sprite.z + 3
  117.     @newgame.z = @background.z + 3
  118.     @continue.z = @newgame.z
  119.     @credits.z = @newgame.z
  120.     @exit.z = @newgame.z
  121.     @sprite.visible = false
  122.   #============================================#
  123.   # Definindo as Coordenadas X e Y das Imagens #
  124.   #============================================#
  125.     @newgame.x = 70
  126.     @continue.x = @newgame.x + @continue.width + 25
  127.     @credits.x = @continue.x + @credits.width + 25
  128.     @exit.x = @credits.x + @exit.width + 25
  129.     @newgame.y = (Graphics.height - @newgame.height)/2
  130.     @continue.y = @newgame.y
  131.     @credits.y = @newgame.y
  132.     @exit.y = @newgame.y
  133.   #=====================================#
  134.   # Definindo a opacidade das Imagens   #  
  135.   #=====================================#
  136.     @newgame.opacity = 0
  137.     @continue.opacity = 0
  138.     @exit.opacity = 0
  139.     @credits.opacity = 0
  140.     @background.opacity = 80  
  141.   #======================================#
  142.   # bla bla bla bla bla bla bla bla bla  #  
  143.   #======================================#
  144.     @efetuar_fadein = true           # Efetuar Fade in Inicial
  145.     @command_window.opacity = 0      # Janela de comando com Opacidade 0
  146.     @command_window.contents_opacity = 0  # Deixando o conteudo da Janela de Comando em 0
  147.     @command_window.active = false   # Agora a janela de Comandos é  inativa
  148.     @img = Sprite.new              
  149.     @img.bitmap = Cache.picture(PIC_NAMES[7])
  150.     @img.visible = false           # A imagem ainda não é visivel
  151.     @img.z = @newgame.z + 100
  152.    
  153.     @background.visible = false # // Testing
  154.   end
  155.  
  156.   #=====================================#
  157.   # Criando a Janela de Comandos        #  
  158.   #=====================================#
  159.   def create_command_window
  160.     s1 = Vocab::new_game
  161.     s2 = Vocab::continue
  162.     s3 = Vocab::shutdown
  163.     s4 = ""                           # Criando 6 opções na janela de comando
  164.     @command_window = Window_Command.new(544, [s1, s2, s3,s4],4)
  165.     if @continue_enabled                    # Se houver arquivos salvos
  166.       @command_window.index = 1             # Opção habilitada
  167.     else                                    # Se não houver arquivos salvos
  168.       @command_window.draw_item(1, false)   # Opção desabilitada
  169.     end
  170.     @command_window.openness = 0
  171.     @command_window.open()
  172.     @sprite = @sprites[@command_window.index]
  173.   end
  174.  
  175.   #==============#
  176.   # Atualizando  #  
  177.   #==============#
  178.   def update()
  179.     tg_update_title_graphics()
  180.     @command_window.update
  181.     @img.opacity += 1 if @img.opacity < 255
  182.     @background.opacity += 1 if @background.opacity < BG_FINAL_OPACITY and @efetuar_fadein == true
  183.     @newgame.opacity += 1 if @newgame.opacity < 255 and @background.opacity > 100 and @efetuar_fadein == true
  184.     @continue.opacity += 1 if @newgame.opacity >= 55 and @continue.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  185.     @credits.opacity += 1 if @continue.opacity >= 55 and @credits.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  186.     @exit.opacity += 1 if @credits.opacity >= 55 and @exit.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  187.     if Input.trigger?(Input::B) and @img.visible == true   # Se estiver na tela de creditos e apertar ESC
  188.       @img.visible = false
  189.       @command_window.visible = true
  190.     end    
  191.     if @exit.opacity >= BOX_PIC_FINAL_OPACITY
  192.       @command_window.active = true
  193.       @efetuar_fadein = false
  194.     end
  195.     if @command_window.index == 0 and @efetuar_fadein == false
  196.       @newgame.opacity = 255
  197.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  198.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  199.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  200.       @index = 0
  201.     elsif @command_window.index == 1
  202.       @continue.opacity = 255
  203.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  204.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  205.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  206.       @index = 1
  207.     elsif @command_window.index == 2
  208.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  209.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  210.       @credits.opacity = 255
  211.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  212.       @index = 2
  213.     elsif @command_window.index == 3
  214.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  215.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  216.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  217.       @exit.opacity = 255
  218.       @index = 3
  219.     end
  220.     if Input.trigger?(Input::C)
  221.       case @index
  222.       when 0
  223.         command_new_game
  224.       when 1
  225.         command_continue
  226.       when 2
  227.         Sound.play_decision
  228.         @command_window.active = false
  229.         @command_window.visible = false
  230.         @img.visible = true
  231.         @img.opacity = 0
  232.       when 3
  233.         command_shutdown
  234.       end
  235.     end
  236.   end
  237.  
  238.   #=======================================================#
  239.   # Terminando e efetuando a disposição das Imagens       #  
  240.   #=======================================================#
  241.  
  242.   alias rafidelis_kaHh_box_menu_terminate terminate unless $@
  243.   def terminate( *args, &block )
  244.     rafidelis_kaHh_box_menu_terminate( *args, &block )
  245.     @newgame.dispose()
  246.     @continue.dispose()
  247.     @credits.dispose()
  248.     @exit.dispose()
  249.     @background.dispose()
  250.   end
  251.  
  252. end
  253. #================================================================================
  254. # FIM DO SCRIPT - Encontre mais Scripts de Rafidelis em www.ReinoRpg.com/forum
  255. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Advertisement
Add Comment
Please, Sign In to add comment