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


    barra de load antes do teleporte [WIN] Window_Teleport

    Maephel
    Maephel
    Ocasional
    Ocasional


    Mensagens : 212
    Créditos : 18

    barra de load antes do teleporte [WIN] Window_Teleport Empty barra de load antes do teleporte [WIN] Window_Teleport

    Mensagem por Maephel Sex Nov 28, 2014 6:20 pm

    Barra no teleporte







    descrição




    Antes de executar a transição para o loca de destino uma barra de load aparece em cima do player.

    primeiro passo

    vá em [WIN] Window_Teleport na parte de:

    Código:
     #--------------------------------------------------------------------------
      # * Atualização do Frame
      #--------------------------------------------------------------------------
      def update

    e troque por este:

    Código:
     def update
        super
        @title.update
        refresh if @old_quests != @data
        if Input.trigger?(Input::C) or can_pressed?
          return if $game_party.item_number(Config::GOLD_ID.to_i) < Config::TELEPORT[index+1][1]
          return if item == nil
          #return if @data[index] == nil
          unless Config::TELEPORT[index+1][5].nil?
            if Config::TELEPORT[index+1][5] > $game_party.actors[0].level
              Chat.add("#{Vocab::TELEPORTERROR} #{Config::TELEPORT[index+1][5]}.", Config::ERROR_COLOR)
              return
            end
          end
          on_close
          teleport_bar
        end
      end
      def teleport_bar
        ligar_barra
        Thread.new {
        #Loop fica rodando, enquanto a variável for menor que 100.
        while($game_variables[11] < 100)
          sleep(0.1)
          #Adiciona 1 à variável.
          $game_variables[11] += 1
        end
        desligar_barra
        teleport
        }
      end
      def teleport
        $game_temp.player_new_map_id = Config::TELEPORT[index+1][2]
        $game_temp.player_new_x = Config::TELEPORT[index+1][3]
        $game_temp.player_new_y = Config::TELEPORT[index+1][4]
        $game_temp.player_transferring = true
        Network::Main.send_animation(15)
        $game_player.animation_id = 15
        $game_map.update
        $game_player.turn_down
        $game_party.lose_item(Config::GOLD_ID.to_i, Config::TELEPORT[index+1][1])
      end

    segundo passo

    e adicione isto para a barra de load:
    Código:
    #==============================================================================
    #       Barra de load
    #       autor: Peaverin
    #       edição: Matheus Melo (plug and play)
    #==============================================================================
    module LOAD
      # variavel que armazenará os valor que encherá a barra
      VAR = 11
      #switch que ativa a barra de carregamento
      SWI = 10
    end
    class Min < RPG::Sprite
      def initialize
        super()
        # Nome da Hud de base da barra.
        @base = RPG::Cache.picture("Actor Base")
        @base_rect = Rect.new(0, 0, @base.width, @base.height)
        # Nome da Hud da barra cheia.
        @M = RPG::Cache.picture("Actor MIN")
        self.bitmap = Bitmap.new(@base.width, @base.height)
        refresh
      end
      
      def update
        super
        refresh if something_changed?
      end
      
      def something_changed?
        return true if @old_pic != $game_variables[LOAD::VAR]
        return true if @old_x != $game_player.screen_x - 14
        return true if @old_y != $game_player.screen_y - 50
        return false
      end
      
      def refresh
        @old_pic = $game_variables[LOAD::VAR]
        if $game_switches[LOAD::SWI] == true
              @old_x = $game_player.screen_x - 14
        @old_y = $game_player.screen_y - 50
        self.bitmap.clear
        self.x = $game_player.screen_x - 14
        self.y = $game_player.screen_y - 50
        
        # Nessa parte abaixo creio que se define
        # o limite maximoda barra no casso 100
        # $game_variables[LOAD::VAR] / 100
        # creio que se colocar /500 a barra
        # a barra encherá quando a variavel chegar a 500.
              @wid = @M.width * $game_variables[LOAD::VAR] / 100
        @M_rect = Rect.new(0, 0, @wid, @base.height)
      else
            @old_x = $game_player.screen_x - 1000
        @old_y = $game_player.screen_y - 1000
        self.bitmap.clear
        self.x = $game_player.screen_x - 1000
        self.y = $game_player.screen_y - 1000
            @wid = 0
        @M_rect = Rect.new(0, 0, 0, 0)
        end
        self.bitmap.blt(0, 0, @base, @base_rect)
        self.bitmap.blt(0, 0, @M, @M_rect)
      end
    end

    ## Modified by Peaverin
    class Sprite_Character < RPG::Sprite
      alias init initialize
      alias upd update
      def initialize(view, char)
        init(view, char)
        if @character.is_a?(Game_Player)
          @minbar = Min.new
          $minbar = @minbar
        end
      end
      
      def update
        if @character.is_a?(Game_Player) and @minbar != nil
          @minbar.refresh
        end
        upd
      end
    end

    terceiro passo

    e por fim adicione esta imagens a pasta picture:
    barra de load antes do teleporte [WIN] Window_Teleport 2ziuays
    com o nome "Actor Base"



    barra de load antes do teleporte [WIN] Window_Teleport 2uoglxy
    com nome "Actor MIN"

    ambos sem aspas.


    Código:
     testei logicamente e funciona a unica coisa
     que me incomoda é que o a barra não some se
     o personagem anda!

      Data/hora atual: Ter maio 07, 2024 11:27 pm