Scinaya

Untitled

Oct 8th, 2011
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.64 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. class Scene_Title < Scene_Base
  43.   include Rafidelis
  44.   alias rafidelis_kaHh_box_title_start start
  45.   def start
  46.     rafidelis_kaHh_box_title_start
  47.   #==========================#
  48.   #   Declarando os Sprites  #
  49.   #==========================#
  50.     @newgame = Sprite.new
  51.     @continue = Sprite.new
  52.     @credits = Sprite.new
  53.     @exit = Sprite.new
  54.     @background = Sprite.new
  55.   #==========================#
  56.   #    Criando as Imagens    #
  57.   #==========================#
  58.     @newgame.bitmap = Cache.picture(PIC_NAMES[0])
  59.     @continue.bitmap = Cache.picture(PIC_NAMES[1])
  60.     @exit.bitmap = Cache.picture(PIC_NAMES[4])
  61.     @credits.bitmap = Cache.picture(PIC_NAMES[5])
  62.     @background.bitmap = Cache.picture(PIC_NAMES[6])
  63.     @background.z = @sprite.z + 3
  64.     @newgame.z = @background.z + 3
  65.     @continue.z = @newgame.z
  66.     @credits.z = @newgame.z
  67.     @exit.z = @newgame.z
  68.     @sprite.visible = false
  69.   #============================================#
  70.   # Definindo as Coordenadas X e Y das Imagens #
  71.   #============================================#
  72.     @newgame.x = 70
  73.     @continue.x = @newgame.x + @continue.width + 25
  74.     @credits.x = @continue.x + @credits.width + 25
  75.     @exit.x = @credits.x + @exit.width + 25
  76.     @newgame.y = (Graphics.height - @newgame.height)/2
  77.     @continue.y = @newgame.y
  78.     @credits.y = @newgame.y
  79.     @exit.y = @newgame.y
  80.   #=====================================#
  81.   # Definindo a opacidade das Imagens   #  
  82.   #=====================================#
  83.     @newgame.opacity = 0
  84.     @continue.opacity = 0
  85.     @exit.opacity = 0
  86.     @credits.opacity = 0
  87.     @background.opacity = 80  
  88.   #======================================#
  89.   # bla bla bla bla bla bla bla bla bla  #  
  90.   #======================================#
  91.     @efetuar_fadein = true           # Efetuar Fade in Inicial
  92.     @command_window.opacity = 0      # Janela de comando com Opacidade 0
  93.     @command_window.contents_opacity = 0  # Deixando o conteudo da Janela de Comando em 0
  94.     @command_window.active = false   # Agora a janela de Comandos é  inativa
  95.     @img = Sprite.new              
  96.     @img.bitmap = Cache.picture(PIC_NAMES[7])
  97.     @img.visible = false           # A imagem ainda não é visivel
  98.     @img.z = @newgame.z + 100
  99.   end
  100.   #=====================================#
  101.   # Criando a Janela de Comandos        #  
  102.   #=====================================#
  103.   def create_command_window
  104.     s1 = Vocab::new_game
  105.     s2 = Vocab::continue
  106.     s3 = Vocab::shutdown
  107.     s4 = ""                           # Criando 6 opções na janela de comando
  108.     @command_window = Window_Command.new(544, [s1, s2, s3,s4],4)
  109.     if @continue_enabled                    # Se houver arquivos salvos
  110.       @command_window.index = 1             # Opção habilitada
  111.     else                                    # Se não houver arquivos salvos
  112.       @command_window.draw_item(1, false)   # Opção desabilitada
  113.     end
  114.     @command_window.openness = 0
  115.     @command_window.open
  116.   end
  117.   #==============#
  118.   # Atualizando  #  
  119.   #==============#
  120.   def update
  121.     @command_window.update
  122.     @img.opacity += 1 if @img.opacity < 255
  123.     @background.opacity += 1 if @background.opacity < BG_FINAL_OPACITY and @efetuar_fadein == true
  124.     @newgame.opacity += 1 if @newgame.opacity < 255 and @background.opacity > 100 and @efetuar_fadein == true
  125.     @continue.opacity += 1 if @newgame.opacity >= 55 and @continue.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  126.     @credits.opacity += 1 if @continue.opacity >= 55 and @credits.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  127.     @exit.opacity += 1 if @credits.opacity >= 55 and @exit.opacity < BOX_PIC_FINAL_OPACITY  and @efetuar_fadein == true
  128.     if Input.trigger?(Input::B) and @img.visible == true   # Se estiver na tela de creditos e apertar ESC
  129.       @img.visible = false
  130.       @command_window.visible = true
  131.     end    
  132.     if @exit.opacity >= BOX_PIC_FINAL_OPACITY
  133.       @command_window.active = true
  134.       @efetuar_fadein = false
  135.     end
  136.     if @command_window.index == 0 and @efetuar_fadein == false
  137.       @newgame.opacity = 255
  138.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  139.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  140.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  141.       @index = 0
  142.     elsif @command_window.index == 1
  143.       @continue.opacity = 255
  144.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  145.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  146.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  147.       @index = 1
  148.     elsif @command_window.index == 2
  149.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  150.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  151.       @credits.opacity = 255
  152.       @exit.opacity = BOX_PIC_FINAL_OPACITY
  153.       @index = 2
  154.     elsif @command_window.index == 3
  155.       @continue.opacity = BOX_PIC_FINAL_OPACITY
  156.       @newgame.opacity = BOX_PIC_FINAL_OPACITY
  157.       @credits.opacity = BOX_PIC_FINAL_OPACITY
  158.       @exit.opacity = 255
  159.       @index = 3
  160.     end
  161.     if Input.trigger?(Input::C)
  162.       case @index
  163.       when 0
  164.         command_new_game
  165.       when 1
  166.         command_continue
  167.       when 2
  168.         Sound.play_decision
  169.         @command_window.active = false
  170.         @command_window.visible = false
  171.         @img.visible = true
  172.         @img.opacity = 0
  173.       when 3
  174.         command_shutdown
  175.       end
  176.     end
  177.   end
  178.  
  179.   #=======================================================#
  180.   # Terminando e efetuando a disposição das Imagens       #  
  181.   #=======================================================#
  182.  
  183.  alias rafidelis_kaHh_box_menu_terminate terminate
  184.   def terminate
  185.     rafidelis_kaHh_box_menu_terminate
  186.     @newgame.dispose
  187.     @continue.dispose
  188.     @credits.dispose
  189.     @exit.dispose
  190.     @background.dispose
  191.     end
  192. end
  193. #================================================================================
  194. # FIM DO SCRIPT - Encontre mais Scripts de Rafidelis em www.ReinoRpg.com/forum
  195. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  196.  
Advertisement
Add Comment
Please, Sign In to add comment