Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


+10
Paulo Soreto
God of Darkness
RD12
Nanzin
Valentine
MalucaoBeleza
gustavotx
andrew.ruby.rider
Link
FFogomax
14 participantes

    [Tutorial] Criando uma apresentação antes do menu

    avatar
    FFogomax
    Experiente
    Experiente


    Mensagens : 557
    Créditos : 37

    [Tutorial] Criando uma apresentação antes do menu Empty [Tutorial] Criando uma apresentação antes do menu

    Mensagem por FFogomax Dom Fev 05, 2012 12:48 am

    Introdução
    Esse é meu primeiro tutorial aqui na aldeia. Um membro me pediu e estou aqui postando.

    Downloads
    Arquivos para funcionamento - Você precisa deles para funcionar.

    Aviso
    Sua apresentação deve estar no formato ".swf" para funcionar.
    Use esse programa para converte para o ".swf" caso esteja em outro formato:
    Format Factory - Converta seus arquivos!

    Tutorial
    Para começar, pegue os arquivos que coloquei para download e coloque na pasta do seu jogo.
    [Tutorial] Criando uma apresentação antes do menu 1

    Abra o RMXP e vamos botar a mão na massa.
    Aperte F11 para abrir o editor de scripts e acima do Main cole esse script:
    Código:
    #===============================================================================
    #
    # * Scene_IntroFlash by Dahrkael using 灼眼的夏娜 Flash Player
    #                                                                          v1.0
    #  Requires the .dll and .ocx
    #===============================================================================
    class Scene_IntroFlash
     
      def initialize
        # Set the file which will be played
        @file = "miku.swf"
        # Choose if the player can skip the intro (0 => false, 1 => true)
        @button = 1
      end
     
      def main
        # Black background
        @fondo = Sprite.new
        @fondo.bitmap = Bitmap.new(640, 480)
        @fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))
        @fondo.z = -1
        # Set flash video
        fls = RMFlash.load(@file, 640, 480)
        fls.loop = 1
        fls.z = 2
        # Save frame rate
        @fr = Graphics.frame_rate
        # Set new frame rate
        Graphics.frame_rate = 40
        # Main loop
        Graphics.transition
        while true
          Graphics.update
          #Input.update
          fls.update
          # Skip the video using Enter
          break if @button == 1 and Keyb.trigger($keys["Enter"])
          # Skip when finished
          break if !fls.playing?
        end
        $scene = Scene_Title.new
        Graphics.freeze
        # Little solution for frozen images
        fls.z = -2
        fls.dispose
        # Set old frame rate
        Graphics.frame_rate = @fr
      end
    end
    Chame ele de "Scene_IntroFlash".

    Crie outro script acima do Main e cole isso:
    Código:
    class Font
      alias font_fix_initialize initialize
      def initialize
        font_fix_initialize
        self.name = "Arial" # Nombre de la fuente
        self.size = 25 # Tamaño
      end
    end
    Chame ele de "Fonts".
    [Tutorial] Criando uma apresentação antes do menu 2

    Agora faça um script lá em cima, e cole isso:
    Código:
    #==============================================================================#
    #                                                                Version 0.3  #
    #                        RPG Maker XP Flash Player                            #
    #                                                                              #
    #  Author: 灼眼的夏娜                    Updated by:  Fogomax                    #
    #                                                                              #
    #  Interactive flashes requires RGSS knownledge to make they work              #
    #                                                                              #
    #  Original Keyb module by HoundNinja                                          #
    #                                                                              #
    #==============================================================================#



    class String
     
      CP_ACP = 0
      CP_UTF8 = 65001
     
      def u2s
        m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
        w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
       
        len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
        buf = "\0" * (len*2)
        m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
       
        len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
        ret = "\0" * len
        w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
       
        return ret
      end
     
      def s2u
        m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
        w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
     
        len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
        buf = "\0" * (len*2)
        m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);
     
        len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
        ret = "\0" * len
        w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
       
        return ret
      end

      def s2u!
        self[0, length] = s2u
      end 
     
      def u2s!
        self[0, length] = u2s
      end
     
    end

    class Bitmap
     
      RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
      RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')

      def address
        buffer, ad = "xxxx", object_id * 2 + 16
        RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 8
        RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 16
        RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")[0]
      end
     
    end

    class RMFlash

       API_NEW            = Win32API.new("RMFlash", "_new", "piil", "l")
       API_UPDATE       = Win32API.new("RMFlash", "_update", "l", "v")
       API_FREE         = Win32API.new("RMFlash", "_free", "l", "v")
       API_PLAYING    = Win32API.new("RMFlash", "_is_playing", "l", "i")
       API_PAUSE         = Win32API.new("RMFlash", "_pause", "l", "v")
       API_RESUME       = Win32API.new("RMFlash", "_resume", "l", "v")
       API_BACK         = Win32API.new("RMFlash", "_back", "l", "v")
       API_REWIND       = Win32API.new("RMFlash", "_rewind", "l", "v")
       API_FORWARD       = Win32API.new("RMFlash", "_forward", "l", "v")
       API_CURFRAME     = Win32API.new("RMFlash", "_cur_frame", "l", "i")
       API_TOTALFRAME   = Win32API.new("RMFlash", "_total_frames", "l", "i")
       API_GOTOFRAME     = Win32API.new("RMFlash", "_goto_frame", "li", "v")
       API_GETLOOP        = Win32API.new("RMFlash", "_get_loop", "l", "i")
       API_SETLOOP        = Win32API.new("RMFlash", "_set_loop", "li", "v")
       API_CLEARALL     = Win32API.new("RMFlash", "_clear_all", "v", "v")
      API_VALID      = Win32API.new("RMFlash", "_valid", "l", "i")
      API_SENDMSG    = Win32API.new("RMFlash", "_send_message", "liii", "l")
       
      CUR_PATH        = Dir.pwd
     
       def self.get_version

       end

       def self.clear_all
          API_CLEARALL.call
       end
     
      def self.load(name, width, height, v = nil)
        new("#{CUR_PATH}/Graphics/Flash/#{name}".u2s, width, height, v)
      end
     
      attr_reader  :valid

       def initialize(flash_name, flash_width, flash_height, viewport = nil)
          @sprite = Sprite.new(viewport)
          @sprite.bitmap = Bitmap.new(flash_width, flash_height)
          @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)
          @loop = API_GETLOOP.call(@value) > 0
        @valid = API_VALID.call(@value) > 0
       end

       def viewport
          @sprite.viewport
       end

       def update
          API_UPDATE.call(@value)
       end

       def dispose
          API_FREE.call(@sprite.bitmap.address)
       end

       def playing?
          API_PLAYING.call(@value) > 0
       end

       def pause
          API_PAUSE.call(@value)
       end

       def resume
          API_RESUME.call(@value)
       end

       def back
          API_BACK.call(@value)
       end

       def rewind
          API_REWIND.call(@value)
       end

       def forward
          API_FORWARD.call(@value)
       end

       def current_frame
          API_CURFRAME.call(@value)
       end

       def total_frames
          API_TOTALFRAME.call(@value)
       end

       def goto_frame(goal_frame)
          API_GOTOFRAME.call(@value, goal_frame)
       end

       def x
          @sprite.x
       end

       def x=(v)
          @sprite.x = v
       end

       def y
          @sprite.y
       end

       def y=(v)
          @sprite.y = v
       end

       def z
          @sprite.z
       end

       def z=(v)
          @sprite.z = v
       end

       def width
          @sprite.bitmap.width
       end

       def height
          @sprite.bitmap.height
       end

       def loop?
          @loop
       end

       def loop=(v)
          if @loop != v
             @loop = v
             API_SETLOOP.call(@value, v)
          end
       end
     
      def msg_to_flash(msg, wParam, lParam)
        return API_SENDMSG.call(@value, msg, wParam, lParam)
      end
     
      #  例
      WM_MOUSEMOVE  = 0x0200
     
      def make_long(a, b)
        return (a & 0xffff ) | (b & 0xffff) << 16
      end
     
      def on_mouse_move(x, y)
        return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))
      end

    end

    module Kernel

      alias origin_exit exit unless method_defined? :exit
     
      def exit(*args)
        RMFlash.clear_all
        origin_exit(*args)
      end
     
    end

    module Keyb
      $keys = {}
      $keys["Enter"] = 0x0D
      GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
      module_function
      def trigger(rkey)
        GetKeyState.call(rkey) & 0x01 == 1
      end
    end

    class Play
     
      def play(filename, button)
        fondo = Sprite.new
        fondo.bitmap = Bitmap.new(640, 480)
        fondo.bitmap.fill_rect(0, 0, 640, 480, Color.new(0,0,0,255))
        fls = RMFlash.load(filename, 640, 480)
        fls.loop = 1
        fls.z = 9999
        @button = button
        @fr = Graphics.frame_rate
        Graphics.frame_rate = 40

        while true
          Graphics.update
          #Input.update
          fls.update
          break if @button == 1 and Keyb.trigger($keys["Enter"])
          break if !fls.playing?
          end
        fls.dispose
        Graphics.frame_rate = @fr
        fondo.dispose
      end
    end
    Chame ele de "RMFlash".
    [Tutorial] Criando uma apresentação antes do menu 7

    Agora, vá na pasta do seu projeto e dentro da pasta Graphics crie uma pasta chama "Flash".
    [Tutorial] Criando uma apresentação antes do menu 3
    Cole sua introdução em ".swf" dentro dessa pasta.
    [Tutorial] Criando uma apresentação antes do menu 4

    Agora, vamos fazer isso ser reproduzido antes do menu.
    Vá no script Main e na linha 31:
    Substitua:
    Código:
    $scene = Scene_Title.new
    Por:
    Código:
    $scene = Scene_IntroFlash.new
    [Tutorial] Criando uma apresentação antes do menu 5

    Vá no script Scene_IntroFlash(o que você colocou), na linha 11:
    Troque:
    Código:
    miku.swf
    Pelo nome do seu arquivo ".swf".
    [Tutorial] Criando uma apresentação antes do menu 6

    Agora salve tudo e aperte F12 para testar.

    Extra
    Esse script também serve para fazer apresentações dentro do jogo.
    Basta criar um evento, coloca a função "Chama Script" e cole isso:
    Código:
    [coe]$flash.play("arquivo_flash.swf", botão)
    Mude:
    Código:
    arquivo_flash.swf
    Para o nome do seu arquivo ".swf".

    Atenção: O arquivo deve estar na pasta Flash que você criou.

    Créditos
    A mim por disponibilizar aqui na Aldeia, e por criar o tópico.

    Final
    Bom, é isso. Obrigado por lerem. Até a próxima! Razz


    Última edição por Fogomax em Dom Fev 05, 2012 5:23 pm, editado 7 vez(es)
    Link
    Link
    Membro Ativo
    Membro Ativo


    Mensagens : 307
    Créditos : 35

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por Link Dom Fev 05, 2012 1:00 am

    Muito bom +1cred.


    _________________
    Zelda eu irei te salvar
    avatar
    FFogomax
    Experiente
    Experiente


    Mensagens : 557
    Créditos : 37

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por FFogomax Dom Fev 05, 2012 1:27 am

    Valeu, é o meu primeiro tópico.
    E eu já criei outro pra ajudar esse.
    Está na parte dos avisos. Razz
    andrew.ruby.rider
    andrew.ruby.rider
    Iniciante
    Iniciante


    Mensagens : 71
    Créditos : 4

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por andrew.ruby.rider Dom Fev 05, 2012 1:43 am

    deu erro na linha 23...

    arquivo imcompleto, tenta rodar fogomax -.-'
    já consegui completa-lo, dps eu posto essa desgrama q me deu dor de cabeça
    gustavotx
    gustavotx
    Experiente
    Experiente


    Mensagens : 411
    Créditos : 64

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por gustavotx Dom Fev 05, 2012 8:48 am

    muito bom +1 cre vai ser bem util

    MAIS SO FALTO AS SCREEN, TA UMPOUCO COMPLICADO TEM COMO COLOCAR SCREEN?


    _________________
    Meu Game Lupus Online:

    [Tutorial] Criando uma apresentação antes do menu Sing2zq

    [Tutorial] Criando uma apresentação antes do menu AIymW
    Tem Meu Respeito:
    andrew.ruby.rider
    andrew.ruby.rider
    Iniciante
    Iniciante


    Mensagens : 71
    Créditos : 4

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por andrew.ruby.rider Dom Fev 05, 2012 3:48 pm

    Sinceramente, o arquivo está incompleto!!!
    Da CLOSED aqui! não ta funcional...
    avatar
    FFogomax
    Experiente
    Experiente


    Mensagens : 557
    Créditos : 37

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por FFogomax Dom Fev 05, 2012 5:02 pm

    Como incompleto?
    Vou postar umas SS aqui.
    Já estou editando. Fury
    MalucaoBeleza
    MalucaoBeleza
    Desenvolvedor
    Desenvolvedor


    Medalhas : [Tutorial] Criando uma apresentação antes do menu ILtUbYveyXDIf
    Mensagens : 723
    Créditos : 58

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por MalucaoBeleza Dom Fev 05, 2012 6:15 pm

    posta uma screen
    avatar
    FFogomax
    Experiente
    Experiente


    Mensagens : 557
    Créditos : 37

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por FFogomax Dom Fev 05, 2012 7:47 pm

    Screen não vai adiantar, mas eu vou postar uma aqui pra vc.
    andrew.ruby.rider
    andrew.ruby.rider
    Iniciante
    Iniciante


    Mensagens : 71
    Créditos : 4

    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por andrew.ruby.rider Dom Fev 05, 2012 8:36 pm

    ótimo! botou o script que estava em cima! aleluia!

    agr ta completo \o/

    Conteúdo patrocinado


    [Tutorial] Criando uma apresentação antes do menu Empty Re: [Tutorial] Criando uma apresentação antes do menu

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sex Abr 26, 2024 5:52 am