Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

NamKazt's Flatform Move Systems : New Version 1.4.4

NamKazt's Platform Move Systems Version: 1.4.4
By: NamKazt (Me)
(" i'm Vietnamese and my english not good, sr all about that :shades: ")

Introduction

This script used to make a platform move 2 direction, e.g : Maplestory,patapon,...
This not like XRXS's Script.. this better then... :box:

Features
  • Flatform Movement ( suck as Maplestory, Patapon ,...)
  • Pixel per pixel movement

Update in 1.4.4
Code:
#      +, Add Ladder ^^~

#         you can add [Ladder] into name of event and set it through

#         e.g : EV001[W100][H200][Ladder]

#      +, Add Fly obj like a bird ^^~

#         you can add [Fly] into name of event

#         e.g : EV001[W100][H200][Fly]

#         only event is fly obj, in move random mode is can move 8 directionr

#      +, remove game crash if event dont have width or height or ...

 

Update in 1.4.3
Code:
#      +, Add height of event

#         e.g : EV001[W380][H200]

#         for obj and for a gate ^^~

#      +, fixbug event blow another event or player

Update in 1.4.2
Code:
#      +, Add width of event 

#          like : Event id 1 have name is EV001 and width of it's 380

#                 you must named it to EV001[W380]

#                 without it, game will crash!

#         -> it'll improve smooth when you touch events with other size

#         -> suck as a chest have width is 35, a dragon have width is 600

#      +, Improve smooth by use real_x ( old is using x )

#      +, Add block player if event not through ( problem is distance too long )

#      +, fix bug distance too long

 

Future
  • Add Action suck as throw or push event

Screenshots (in version 1.4.4)

iMfE2


Demo All Version

Code:
[url=http://www.mediafire.com/?aov12bgb76npr]http://www.mediafire.com/?aov12bgb76npr[/url]

Script

Code:
#==============================================================================

# ** NamKazt's Platform Move Systems

#------------------------------------------------------------------------------

#  Version : 1.4.4

#   * Features :

#     +, Flatform Movement ( suck as Maplestory, Patapon ,...)

#     +, Pixel per pixel movement

#------------------------------------------------------------------------------

#  Future :

#     +, Add action suck as throw or push event

#------------------------------------------------------------------------------

#  Update 1.4.4 :

#      +, Add Ladder ^^~

#         you can add [Ladder] into name of event and set it through

#         e.g : EV001[W100][H200][Ladder]

#      +, Add Fly obj like a bird ^^~

#         you can add [Fly] into name of event

#         e.g : EV001[W100][H200][Fly]

#         only event is fly obj, in move random mode is can move 8 direction

#------------------------------------------------------------------------------

#  Update 1.4.3 :

#      +, Add height of event

#         e.g : EV001[W380][H200]

#         for obj and for a gate ^^~

#      +, fixbug event blow another event or player

#------------------------------------------------------------------------------

#  Update 1.4.2 :

#      +, Add width of event

#          like : Event id 1 have name is EV001 and width of it's 380

#                 you must named it to EV001[W380]

#                 without it, game will crash!

#         -> it'll improve smooth when you touch events with other size

#         -> suck as a chest have width is 35, a dragon have width is 600

#      +, Improve smooth by use real_x ( old is using x )

#      +, Fixbug distance too long

#------------------------------------------------------------------------------

#  Update 1.4.1 :

#      +, Add block player if event not through

#------------------------------------------------------------------------------

#  Thanks :

#   HikiMoKi for the idea and base

#   I just was developing the idea for XP

#==============================================================================

 

class Game_Character

  attr_reader   :xv                       # Trục x

  attr_reader   :yv                       # Trục y

  attr_accessor :gravity                  # Nặng

  #--------------------------------------------------------------------------

  # * 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

  #--------------------------------------------------------------------------

  # * Determine if player on ladder

  #--------------------------------------------------------------------------

  def ladder?

    # If logical coordinates differ from real coordinates,

    # movement is occurring.

    if self == $game_player and check_event_ladder_here([0])

      return true

    end

    return false

  end

  #--------------------------------------------------------------------------

  # * Check if on ladder

  #--------------------------------------------------------------------------

  def check_event_ladder_here(triggers)

    # All event loops

    for event in $game_map.events.values

      @size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

      if event.get_name.include? "[Ladder]"

        # If event coordinates and triggers are consistent

        if self.real_x >= (event.real_x - @size) and self.real_x <= (event.real_x + @size) and self.real_y > event.real_y - @height - 30 and self.real_y <= event.real_y + 5 and triggers.include?(event.trigger)

            return true

        end

      end

    end

    return false

  end

  #--------------------------------------------------------------------------

  # * Determine if event is fly obj

  #--------------------------------------------------------------------------

  def isfly?

    # If logical coordinates differ from real coordinates,

    # movement is occurring.

    if self != $game_player and self.get_name.include? "[Fly]"

      return true

    end

    return false

  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)

    

    if self != $game_player and self.get_name.include? "[Ladder]"

      return false

    end

    

    left_x = @real_x >> 7    # 4 << 3

    right_x = @real_x >> 7  # 28 << 3

    up_y = @real_y>> 7      # 2 << 3

    down_y = @real_y + 40>> 7   # 28 << 3

      # Get new coordinates

    if self != $game_player

      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

    else

      if ladder? && Input.press?(Input::DOWN)

        return true

      else

        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

      end

    end

   

    if @through

      return true

    end

   

   

    # 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

      

      if(self != $game_player)

      @width = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

      @height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"

       

        if self.real_y >= event.real_y - @height and 

           self.real_y <= event.real_y + 5 and 

           self.real_x >= event.real_x - @width and

           self.real_x <= event.real_x + @width and

           self != event

           

          unless event.through and self.through

            return false

          end

          

        end

      end

      @width = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

       @height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"

        if $game_player.real_y >= event.real_y - @height and 

           $game_player.real_y <= event.real_y + 125 and # height of player

           $game_player.real_x >= event.real_x - @width and

           $game_player.real_x <= event.real_x + @width

             unless event.through

               return false

             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

    elsif ladder?

      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 !ladder? 

      if !isfly?

        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

      else

        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

    else

      if Input.press?(Input::UP)

        #last_y = @real_y

        @real_y -= 5;

        @y = @real_y >> 7

      elsif Input.press?(Input::DOWN)

        turn_down

        #last_y = @real_y

        @real_y += 5;

        @y = @real_y >> 7

      else

        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

    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

    if !isfly?

      @a = rand(1000)

      if @a % 2 == 0

        move_left(false)

      else

        move_right(false)

      end

    else

      case rand(8)

        when 0;  move_left(false)

        when 1;  move_right(false)

        when 2;  move_up(false)

        when 3;  move_down(false)

        when 4;  move_lower_left

        when 5;  move_lower_right

        when 6;  move_upper_left

        when 7;  move_upper_right

      end

    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 = -8

    @xv = [@xv + 1, max_speed].min if @xv < max_speed and !@jump_flag

    @xv = [@xv - 1, max_speed].max if @xv > max_speed

    @move_count = 1

  end

 

  def move_right(turn_ok = true)

    turn_right

    max_speed = 8

    @xv = [@xv + 1, max_speed].min if @xv < max_speed

    @xv = [@xv - 1, max_speed].max if @xv > max_speed and !@jump_flag

    @move_count = 1

  end

 

  def update_x

    if !@jump_flag && !moving?

      @xv = [@xv + 1, 0].min if @xv < 0

      @xv = [@xv - 1, 0].max if @xv > 0

    end

    if !ladder?

      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

    else

      if Input.press?(Input::UP) || Input.press?(Input::DOWN)

        turn_up

        last_x = @real_x

        @x = @real_x >> 7

      else

        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

    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::UP) && @jump_flag == false    # Jump

      move_jump(-48)

    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

  #--------------------------------------------------------------------------

  # * Same Position Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_here(triggers)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # All event loops

    for event in $game_map.events.values

      @size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

      # If event coordinates and triggers are consistent

      if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and triggers.include?(event.trigger)

        # If starting determinant is same position event (other than jumping)

        if not event.jumping? and event.over_trigger?

          event.start

          result = true

          return result

        end

      end

    end

    return result

  end

  

  #--------------------------------------------------------------------------

  # * Front Envent Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_there(triggers)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # Calculate front event coordinates

    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

    # All event loops

    for event in $game_map.events.values

      @size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

      # If event coordinates and triggers are consistent

      if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36 and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and triggers.include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          event.start

          result = true

          return result

        end

      end

    end

    # If fitting event is not found

    if result == false

      # If front tile is a counter

      if $game_map.counter?(new_x, new_y)

        # Calculate 1 tile inside coordinates

        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)

        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)

        # All event loops

        for event in $game_map.events.values

          @size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

          # If event coordinates and triggers are consistent

          if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36  and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and

             triggers.include?(event.trigger)

            # If starting determinant is front event (other than jumping)

            if not event.jumping? and not event.over_trigger?

              event.start

              result = true

              return result

            end

          end

        end

      end

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Touch Event Starting Determinant

  #--------------------------------------------------------------------------

  def check_event_trigger_touch(x, y)

    result = false

    # If event is running

    if $game_system.map_interpreter.running?

      return result

    end

    # All event loops

    for event in $game_map.events.values

      @size = /\d+/.match(/\[W\d+\]/.match(event.get_name)[0])[0].to_i / 2 if event.get_name.include? "[W"

      @height = /\d+/.match(/\[H\d+\]/.match(event.get_name)[0])[0].to_i if event.get_name.include? "[H"

      # If event coordinates and triggers are consistent

      if @real_x >= (event.real_x - @size) - 36 and @real_x <= (event.real_x + @size) + 36  and $game_player.real_y > event.real_y - @height and $game_player.real_y <= event.real_y + 5 and [1,2].include?(event.trigger)

        # If starting determinant is front event (other than jumping)

        if not event.jumping? and not event.over_trigger?

          event.start

          result = true

          return result

        end

      end

    end

    return result

  end

end

 

class Game_Event < Game_Character

  def get_name

    return @event.name

  end

  

end

How to use
you can see all in the newest demo version

Credits and Thanks
NamKazt
HikiMoKi

Author's Notes

if you have a bug, plz pm me

Terms and Conditions

if you use this script, plz give me and HikiMoKi credit
 
Woaw, nice one, works really smooth!
The pixelperpixel movement and the little slide when you turn round while going are cool eyecandy, good work!

Still testing it-

  • How can you change jump heigh?
    460 move_jump(-75) #def 48
    *Could you add that I can change it by a callscript?
    like: jump_heigh=xx pixel
    *Could you implent doubel jump plz :)?
    *Could the distance you jump when being in motion for a while being increas
ed?
 
... i'm Vietnamese and i am not clear about your question. ... :eek::
but some thing i can :D

How can you change jump heigh?
Player :
Code:
Class Game_Player

  #--------------------------------------------------------------------------

  # * Jump

  #  Không cần nhập giá trị x và y ở RMXP

  #--------------------------------------------------------------------------

  def jump(x_plus, y_plus)

    return if @jump_flag

    @yv = [b]-48[/b]

    @jump_flag = true

    @stop_count = 0

  end
this can change jump height

and def jump in class game_character : change jump height for event or move route

Could you implent doubel jump plz :)?
i will try it :) now thanks for your ideas...
Could you add that I can change it by a callscript?
like: jump_heigh=xx pixel

ya.! it can do so but must be revised :D

sr about my english , tell me if I misunderstand your comments
 
I like you more and more :3
You udnerstood it perfectly, the last thing I'm looking forward to is the following:

If the player runs for x amount of time. Let's say 1second
Than he should jump x higher, and run x faster.
Thanks a lot in advance :)

~Ragnai
 

Jason

Awesome Bro

Holy shit this is actually really good and works great, AND it clears up the up and down buttons so they can be used for other things...

Y'see, I've been making a platforming game myself but with events for the platforming system, and with this, my frame rate won't drop due to all the conditional branches etc, AND it's easier than learning in Game Maker, lol.

I've just got one question, is there a way to make it so you can't walk through event characters ?

Or maybe, you can only walk past them if they have a $ in their name or something ?

So you can't walk past boy (He's a solid object), but you can walk past $man

Because if so, that'd be great for me.

Also, just a little something you could add, if a tiles priority is 5*, then it shows above the player, and can't be jumped onto,

For example, walking along a path with a fence, but the fence shows above the player (So it's like he's stood behind and not on top of it), and when he jumps he doesn't land on it.

Do you think you could add that maybe ?
 
I'm enjoying it more and more, but could you please implant a function that would make the Player jump?
Something like a trampoline.
Using it somehow like: player_extrajump= -xx

Thanks in advance
~Ragnai

Edit: Could you implant extra graphics for jumping etc? : player_jump[x=numberofframes]
Because it looks like he would be standing in the air on screenshots and it doesn't look much better in the running game :l
test1bmwg.png
 

xppxdd

Member

How do i make a step...
i mean somthing that he can walk beside the ground...


_X_-x--
like he jump to a higher flor...
and how to chenge Keys and stuff like that why you cant add a tutorail if you makeing a script!!!

how i make the defult X.Y be a little higher not at 0,0 but like to 5,5........

.... thx ....
 
I think there is a big need for a demo here.
I will make one for tomorrow, just say what you want to see in it.
I already explained how to make a step, change gravity and jump heigh.

~Ragnai
 
sr for my work is very slow, i'm busy for now... more more exam... and i cant complete my platform script :-S.
sr u, i'll done it when my exam finish.
 

Proto

Member

Everything works but the jumping, can somebody help?
EDIT: And i cant activate my transfer events. Nice script though.
 

Jeea

Member

just make an event for jumping..

I made one ..

Awesome script, Anyway.. I'd recommend it to the others..
but I have a problem,

when I set an event to event touch or player touch, and tested it,
the event won't trigger!!
Please help!..

in the ladder, I tried using jump and putting a block for going down..
(now it acts like stairs..)

anyway,
for those who are kinda tired of pasting it to one rmxp project just to test it,
here it is!

It's not just pasted, or something, it would seem like a minigame..
Code:
[url=http://www.mediafire.com/file/9lz7zwl1frbga40/Platform%20Move%20System%20Demo.exe]http://www.mediafire.com/file/9lz7zwl1f ... 20Demo.exe[/url]
It inlcudes the jumping system I just made..

the instruction is inside the game..
Edit:I also made the jump higher..
Please, Enjoy..
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top