O Melhor Forum para Animes, Mangás e Utilitarios para seu [PC]...


    Sistema de plataforma.

    Compartilhe

    jiraya
    Admin
    Admin

    Mensagens : 402
    Reputação : 2152
    Créditos : 7
    Idade : 27

    Diverso Sistema de plataforma.

    Mensagem por jiraya em Qui Set 22, 2011 3:38 am

    Autor: lucasspaz
    Oi pessoal.

    Eu sou uma pessoa que corre atrás de sonhos... e Você só porque não achou um sistema de plataforma legal ou não achou tileset em plataforma para seu projeto vai desistir dele? SAI DESSA, CORRE ATRÁS DO SEUS SONHOS AMIGO!
    Eu sou uma pessoa que a 3 anos de Rpg-maker venho querendo um sistema e tiles pro meu projeto em plataforma por isso estou aqui para mostrar os 6 caminhos para o seu jogo de plataforma!

    1.Baixar o RPG Maker Xp.
    2.Baixar o RPT do RPG maker Xp.
    3.Pegue seu Script de Plataforma.
    - "Poxa não encontrei um legal."
    Mas eu tenho o melhor script de plataforma (RGSS) que eu já vi !

    Spoiler:
    Código:
    #======================================#
    #
    #
    # Platform System 2.001
    #  Sweet Liar Adaption
    #
    #
    #
    #======================================#

    class Game_Character
      attr_reader  :xv                      # Tr?c x
      attr_reader  :yv                      # Tr?c y
      attr_accessor :gravity                  # Ð? cao
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      alias pms_initialize initialize
      def initialize
        pms_initialize
        @xv = 0
        @yv = 0
        @move_count = 0
        @gravity = 5
        @jump_flag = false
      end
      #--------------------------------------------------------------------------
      # * Determine if Moving
      #--------------------------------------------------------------------------
      def moving?
        # If logical coordinates differ from real coordinates,
        # movement is occurring.
        return @move_count > 0
      end
      #--------------------------------------------------------------------------
      # * Tocch
      #    mode :
      #    * 0 : Left or Right
      #    * 1 : Up or Down
      #--------------------------------------------------------------------------
      def touch?(mode = 0)
        if mode == 0
          if @xv > 0
            check_event_trigger_touch(@x+1, @y)
          else
            check_event_trigger_touch(@x-1, @y)
          end
        else
          if @xv > 0
            check_event_trigger_touch(@x, @y+1)
          else
            check_event_trigger_touch(@x, @y-1)
          end
        end
      end
      def distance_x_from_player
        sx = @x - $game_player.x
        return sx
      end
      def passable?(mode = 0)
        left_x = @real_x + 32 >> 7    # 4 << 3
        right_x = @real_x + 110 >> 7  # 28 << 3
        up_y = @real_y + 16>> 7      # 2 << 3
        down_y = @real_y + 110 >> 7  # 28 << 3
        # Get new coordinates
        if mode == 0
          if @xv > 0
            return false unless $game_map.passable?(right_x, up_y,6)
            return false unless $game_map.passable?(right_x, down_y,6)
          else
            return false unless $game_map.passable?(left_x, up_y,4)
            return false unless $game_map.passable?(left_x, down_y,4)
          end
        else
          if @yv > 0
            return false unless $game_map.passable?(left_x, down_y,2)
            return false unless $game_map.passable?(right_x, down_y,2)
          else
            return false unless $game_map.passable?(left_x, up_y,8)
            return false unless $game_map.passable?(right_x, up_y,8)
          end
        end
     
        return true if @through
        # Loop all events
        for event in $game_map.events.values
          new_x = (event.direction == 6 ? ((@real_x + 32 >> 7) + 1) : event.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
          new_y = (event.direction == 2 ? ((@real_y + 16 >> 7) + 1) : event.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
          # If event coordinates are consistent with move destination
          if event.x == new_x and event.y == new_y
            # If through is OFF
            unless event.through
              # If self is event
              if self != $game_player
                # impassable
                return false
              end
              # With self as the player and partner graphic as character
              if event.character_name != ""
                # impassable
                return false
              end
            end
          end
        end
     
        new1_x = ($game_player.direction == 6 ? ((@real_x + 32 >> 7) + 1) : $game_player.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
        new1_y = ($game_player.direction == 2 ? ((@real_y + 16 >> 7) + 1) : $game_player.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
       
        if $game_player.x == new1_x and $game_player.y == new1_y
          # If through is OFF
          unless $game_player.through
            # If your own graphic is the character
            if @character_name != ""
              # impassable
              return false
            end
          end
        end
        return true
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        update_x
        update_y
        # Branch with jumping, moving, and stopping
        if jumping?
          update_jump
        elsif moving?
          @move_count -= 1
          if @walk_anime
            @anime_count += 1.5
          elsif @step_anime
            @anime_count += 1
          end
        else
          update_stop
        end
        # If animation count exceeds maximum value
        # * Maximum value is move speed * 1 taken from basic value 18
        if @anime_count > 18 - @move_speed * 2
          # If stop animation is OFF when stopping
          if not @step_anime and @stop_count > 0
            # Return to original pattern
            @pattern = @original_pattern
          # If stop animation is ON when moving
          else
            # Update pattern
            @pattern = (@pattern + 1) % 4
          end
          # Clear animation count
          @anime_count = 0
        end
        # If waiting
        if @wait_count > 0
          # Reduce wait count
          @wait_count -= 1
          return
        end
        # If move route is forced
        if @move_route_forcing
          # Custom move
          move_type_custom
          return
        end
        # When waiting for event execution or locked
        if @starting or lock?
          # Not moving by self
          return
        end
        # If stop count exceeds a certain value (computed from move frequency)
        if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
          # Branch by move type
          case @move_type
          when 1  # Random
            move_type_random
          when 2  # Approach
            move_type_toward_player
          when 3  # Custom
            move_type_custom
          end
        end
      end
      #--------------------------------------------------------------------------
      # ? Update X
      #--------------------------------------------------------------------------
      def update_x
        if !@jump_flag && !moving?
          @xv = 0
          return
        end
        last_x = @real_x
        @real_x += @xv
        @x = @real_x >> 7
        unless passable?(0)
          @real_x = last_x
          @x = @real_x >> 7
          @xv = 0
          touch?(0)
        end
      end
      #--------------------------------------------------------------------------
      # ? Update Y
      #--------------------------------------------------------------------------
      def update_y
        if  @gravity > 0
          @yv += @gravity
          @yv = 64 if @yv > 64
        elsif !moving?
          @yv = 0
          return
        end
        last_y = @real_y
        @real_y += @yv
        @y = @real_y >> 7
        unless passable?(1)
          @real_y = last_y
          @y = @real_y >> 7
          @jump_flag = false if @yv > 0
          @yv = 0
          touch?(1)
        end
      end
      #--------------------------------------------------------------------------
      # * Move Down
      #    turn_enabled : a flag permits direction change on that spot
      #--------------------------------------------------------------------------
      def move_down(turn_enabled = true)
        @stop_count = 0
        d = 2 ** @move_speed
        @yv = d
        @move_count = 128 / d
      end
      #--------------------------------------------------------------------------
      # * Move Left
      #    turn_enabled : a flag permits direction change on that spot
      #--------------------------------------------------------------------------
      def move_left(turn_enabled = true)
        turn_left
        d = 2 ** @move_speed
        @xv = 0 - d
        @move_count = 128 / d
        increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move Right
      #    turn_enabled : a flag permits direction change on that spot
      #--------------------------------------------------------------------------
      def move_right(turn_enabled = true)
        turn_right
        d = 2 ** @move_speed
        @xv = d
        @move_count = 128 / d
        increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move up
      #    turn_enabled : a flag permits direction change on that spot
      #--------------------------------------------------------------------------
      def move_up(turn_enabled = true)
        @stop_count = 0
        d = 2 ** @move_speed
        @yv = 0 - d
        @move_count = 128 / d
      end
      #--------------------------------------------------------------------------
      # * Move Lower Left
      #--------------------------------------------------------------------------
      def move_lower_left
        # If no direction fix
        unless @direction_fix
          # Face down is facing right or up
          @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
        end
          # Update coordinates
          d = 2 ** @move_speed
          @xv = 0 - d
          @yv = d
          @move_count = 128 / d
          # Increase steps
          increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move Lower Right
      #--------------------------------------------------------------------------
      def move_lower_right
        # If no direction fix
        unless @direction_fix
          # Face right if facing left, and face down if facing up
          @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
        end
          d = 2 ** @move_speed
          @xv = d
          @yv = d
          @move_count = 128 / d
          # Increase steps
          increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move Upper Left
      #--------------------------------------------------------------------------
      def move_upper_left
        # If no direction fix
        unless @direction_fix
          # Face left if facing right, and face up if facing down
          @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
        end
          # Update coordinates
          d = 2 ** @move_speed
          @xv = 0 - d
          @yv = 0 - d
          @move_count = 128 / d
          # Increase steps
          increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move Upper Right
      #--------------------------------------------------------------------------
      def move_upper_right
        # If no direction fix
        unless @direction_fix
          # Face right if facing left, and face up if facing down
          @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
        end
          d = 2 ** @move_speed
          @xv = d
          @yv = 0 - d
          @move_count = 128 / d
          # Increase steps
          increase_steps
      end
      #--------------------------------------------------------------------------
      # * Move at Random
      #--------------------------------------------------------------------------
      def move_random
        case rand(@gravity == 0 ? 4 : 2)
        when 0;  move_left(false)
        when 1;  move_right(false)
        when 2;  move_up(false)
        when 3;  move_down(false)
        end
      end
      #--------------------------------------------------------------------------
      # * Move toward Player
      #--------------------------------------------------------------------------
      def move_toward_player
        sx = distance_x_from_player
        sx > 0 ? move_left : move_right
      end
      #--------------------------------------------------------------------------
      # * Move away from Player
      #--------------------------------------------------------------------------
      def move_away_from_player
        sx = distance_x_from_player
        sx > 0 ? move_right : move_left
      end
      #--------------------------------------------------------------------------
      # * Jump
      #  Không c?n nh?p giá tr? x và y ? RMXP
      #--------------------------------------------------------------------------
      def jump(x_plus, y_plus)
        return if @jump_flag
        @yv = -48
        @jump_flag = true
        @stop_count = 0
      end
      #--------------------------------------------------------------------------
      # * Turn Towards Player
      #--------------------------------------------------------------------------
      def turn_toward_player
        if @real_x < $game_player.real_x
          turn_right
        else
          turn_left
        end
      end
    end
     
    class Game_Player < Game_Character
      #--------------------------------------------------------------------------
      # * Passable Determinants
      #--------------------------------------------------------------------------
      def passable?(mode)
        super(mode)
      end
     
      def move_left(turn_ok = true)
        turn_left
        max_speed = -16
        @xv = [@xv + 2, max_speed].min if @xv < max_speed and !@jump_flag
        @xv = [@xv - 2, max_speed].max if @xv > max_speed
        @move_count = 1
      end
     
      def move_right(turn_ok = true)
        turn_right
        max_speed = 16
        @xv = [@xv + 2, max_speed].min if @xv < max_speed
        @xv = [@xv - 2, max_speed].max if @xv > max_speed and !@jump_flag
        @move_count = 1
      end
     
      def update_x
        if !@jump_flag && !moving?
          @xv = [@xv + 2, 0].min if @xv < 0
          @xv = [@xv - 2, 0].max if @xv > 0
        end
        last_x = @real_x
        @real_x += @xv
        @x = @real_x >> 7
        unless passable?(0)
          @real_x = last_x
          @x = @real_x >> 7
          @xv = 0
          touch?(0)
        end
      end
      def move_jump(yv)
        @yv = yv
        @jump_flag = true
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # Remember whether or not moving in local variables
        last_moving = moving?
        # If moving, event running, move route forcing, and message window
        # display are all not occurring
        unless moving? or $game_system.map_interpreter.running? or
              @move_route_forcing or $game_temp.message_window_showing
          # Move player in the direction the directional button is being pressed
          if Input.press?(Input::LEFT)
            move_left
          elsif Input.press?(Input::RIGHT)
            move_right
          end
        end
        if Input.trigger?(Input::Y) && @jump_flag == false    # Jump
          move_jump(-50)
        end
        # Remember coordinates in local variables
        last_real_x = @real_x
        last_real_y = @real_y
        super
        # If character moves down and is positioned lower than the center
        # of the screen
        if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
          # Scroll map down
          $game_map.scroll_down(@real_y - last_real_y)
        end
        # If character moves left and is positioned more let on-screen than
        # center
        if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
          # Scroll map left
          $game_map.scroll_left(last_real_x - @real_x)
        end
        # If character moves right and is positioned more right on-screen than
        # center
        if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
          # Scroll map right
          $game_map.scroll_right(@real_x - last_real_x)
        end
        # If character moves up and is positioned higher than the center
        # of the screen
        if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
          # Scroll map up
          $game_map.scroll_up(last_real_y - @real_y)
        end
        # If not moving
        unless moving?
          # If player was moving last time
          if last_moving
            # Event determinant is via touch of same position event
            result = check_event_trigger_here([1,2])
            # If event which started does not exist
            if result == false
              # Disregard if debug mode is ON and ctrl key was pressed
              unless $DEBUG and Input.press?(Input::CTRL)
                # Encounter countdown
                if @encounter_count > 0
                  @encounter_count -= 1
                end
              end
            end
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Same position and front event determinant
            check_event_trigger_here([0])
            check_event_trigger_there([0,1,2])
          end
        end
      end
    end
     
    class Game_Event < Game_Character
      def get_name
        return @event.name
      end
    end

    4.Seu Tileset plataforma.
    - "Aqui neste fórum tem mas, o que eu quero tem em uma imagem e não tem na outra."
    EU TENHO TUDO EM UMA!(eu acho :lolface:)(-Em qualidade única-)

    Spoiler:
    [size=10pt]Em anexo, Junto com Mapas de exemplo.
    Se não gostou... não posso fazer nada. USE SUA CRIATIVIDADE COM O RPT(Nos exemplos tem)!
    [/size]
    :lolface:

    5. Crie os seu chars, acrescente os seus sistemas, ABS's.
    6. Crie o seu jogo.


    O Script contém alguns bugs , Gostaria que algum scripter possa concertar.
    E o Title set eu fui juntando de várias imagens que eu encontrei referente à plataforma.


    ...é isso ai, espero ter ajudado .

    Exemplo dos mapas:
    [Você precisa estar registrado e conectado para ver este link.]

      Data/hora atual: Sab Dez 03, 2016 3:16 am