LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

Administrator
Administrator
#1 RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
G-PLAT!
Version: 1.2
Author: g@Mef@Ce
Date: 8/3/2011 (month day, year)



Version History

  • GPLAT 1.0 - 7/11/2011


  • GPLAT 1.1 - 7/18/2011


  • GPLAT 1.2 - 8/3/2011



Planned Future Versions

  • it's a surprise :'p


Gravity system for making side scrolling platformers with RMXP




Features
+ user friendly module for easy configuration +

    PLAYER:
  • gravity (w/ disable switch)
  • pixel movement & jump (on/off)
  • sprite alignment
  • dash button
  • dash speed
  • walk speed
  • jump button
  • jump sprite
  • jump animation
  • jump height
  • jump sound
  • air jump (double jump)
  • air jump animation




Screenshots




Instructions

Step 1.) copy the code

Step 2.) open RMXP > F11 (script database)

Step 3.) above "Main" > Insert new script

Step 4.) paste code into right side window

Step 5.) configure module to your liking

Step 6.) enjoy




SCRIPT = Pixel Platformer "GPLAT 1 of 2"
Code:

#===============================================================================
# Pixel Platformer v1.2 by G@MeF@Ce 7/10/2011 "GPLAT 1 of 2"
# http://www.gameface101.com
#-------------------------------------------------------------------------------
# Original Pixel Movement Script by Cogwheel from 66rpg.com
# special thanks to mr_wiggles and moghunter for RGSS support
#
# *free to use, must give credit, do not post on any other site
#==============================================================================

module G101_GPLAT
  #--------------------------------------------------------------------------
  # * configure settings
  #--------------------------------------------------------------------------

  GPLAT_DISABLE_SWITCH = 2        # switch ID to disable gravity switch
  #
  PIXEL_MOVE = true                # pixel movement & jump
 
  #SPRITE settings
  UP    = 32                      #default 32 (0 < UP < 64)
  DOWN  = 0                        #default 16 (0 < DOWN <64)
  SIDE  = 32                      #default 32 (0 < SIDE <64)
 
  #SPEED settings
  DASH_BUTTON = Input::C          # dash button
  WALK_SPEED = 4.8                # set the walk speed
  DASH_SPEED = 5.5                # set the dash speed
 
  #JUMP settings
  JUMP_BUTTON = Input::A          # jump button
  JUMP_SPRITE = ""            # jump graphic character name suffix
  JUMP_ANIMATION_ID  = 0          # animation ID when jump
  JUMP_MAX = 100                    # power of jump
  JUMP_ADD = 4                    # height of single jump
  JUMP_SOUND = ""    # Play Sound when jump
  JUMP_VOLUME = 70                # set volume for jump sound
  JUMP_PITCH = 100                # set the pitch for jump sound

  #AIR JUMP settings
  AIR_JUMP_VAR = 1                # variable ID to set value for air jumps
  AIR_JUMP_ANIMATION_ID = 0        # aniamtion ID when air jump
 
end

#==============================================================================
# Game_Player
#==============================================================================
class Game_Player < Game_Character
 
  include G101_GPLAT
                   
  #--------------------------------------------------------------------------
  # ● public instance variables
  #--------------------------------------------------------------------------
  attr_reader  :event                   
  attr_accessor :move_speed             
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  alias :update_original :update
  def update

    @walk  = WALK_SPEED
    @dash  = DASH_SPEED
    @event = 4
    @dot_m = PIXEL_MOVE

    if @revise_x == nil and @revise_y == nil
      @revise_x = 0
      @revise_y = 0
    end
    unless @dot_m
      update_original
      return
    end
    if @move_route_forcing
      last_moving = moving?
      last_real_x = @real_x
      last_real_y = @real_y
      if (@revise_x != 0 or @revise_y != 0) and not jumping? and @move == true
        if @revise_x != @real_x - @x * 128 or @revise_y != @real_y - @y * 128
          @revise_x = @real_x - @x * 128
          @revise_y = @real_y - @y * 128
        end

        distance1 = 2 ** @move_speed
        distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2)

        if distance1 > distance2
          @real_x = @real_x - @revise_x
          @real_y = @real_y - @revise_y
          @revise_x = 0
          @revise_y = 0
          anime_update
        else
          @real_x -= (distance1 * @revise_x / distance2).round
          @real_y -= (distance1 * @revise_y / distance2).round
          @revise_x = @real_x - @x * 128
          @revise_y = @real_y - @y * 128
          anime_update
        end
      else
        super
      end
    else
      @move = false

      unless moving? or $game_system.map_interpreter.running? or
            @move_route_forcing or $game_temp.message_window_showing
        @event_run = false
#-------------------------------------------------------------------------------
      case Input.dir8
        when 1
          $game_switches[GPLAT_DISABLE_SWITCH] ? move_lower_left_p : move_left_p
        when 2
          move_down_p if $game_switches[GPLAT_DISABLE_SWITCH]
        when 3
        $game_switches[GPLAT_DISABLE_SWITCH] ? move_lower_right_p : move_right_p
        when 4
          move_left_p
        when 6
          move_right_p
        when 7
        $game_switches[GPLAT_DISABLE_SWITCH] ? move_upper_left_p : move_left_p
        when 8
        move_up_p if $game_switches[GPLAT_DISABLE_SWITCH]
        when 9
        $game_switches[GPLAT_DISABLE_SWITCH] ? move_upper_right_p : move_right_p
        end
      end

      last_real_x = @real_x
      last_real_y = @real_y
      @real_x = @x * 128 + @revise_x
      @real_y = @y * 128 + @revise_y
      last_moving = moving?
      move_on

      if (last_real_x != @real_x or last_real_y != @real_y)
        @move_distance = 0 if @move_distance == nil
        @move_distance += Math.sqrt((last_real_x - @real_x) ** 2 +
                                      (last_real_y - @real_y) ** 2)
        if @move_distance >= 128
          @move_distance %= 128
          increase_steps
        end

        anime_update
      else
        @pattern = 0
      end
    end

    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
      $game_map.scroll_down(@real_y - last_real_y)
    end

    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
      $game_map.scroll_left(last_real_x - @real_x)
    end

    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
      $game_map.scroll_right(@real_x - last_real_x)
    end

    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
      $game_map.scroll_up(last_real_y - @real_y)
    end

    if last_moving
      result = check_event_trigger_here([1,2])
      if result == true
        if (last_real_x / 128.0).round != @x and
            (last_real_y / 128.0).round != @y
          if @direction == 2 or @direction == 8
            if (last_real_x / 128.0).round > @x
              turn_left
            else
              turn_right
            end
          else
            if (last_real_y / 128.0).round > @y
              turn_up
            else
              turn_down
            end
          end
        elsif (last_real_x / 128.0).round > @x
          turn_left
        elsif (last_real_x / 128.0).round < @x
          turn_right
        elsif (last_real_y / 128.0).round > @y
          turn_up
        elsif (last_real_y / 128.0).round < @y
          turn_down
        end
      end

      if result == false
        unless $DEBUG and Input.press?(Input::CTRL)
          if @encounter_count > 0
            @encounter_count -= 1
          end
        end
      end
    end
#-------------------------------------------------------------------------------
      unless $game_system.map_interpreter.running? or
            @move_route_forcing or $game_temp.message_window_showing
    if Input.press?(JUMP_BUTTON) and not $game_switches[GPLAT_DISABLE_SWITCH]
      @twojump = 1 if @twojump == 0 and down1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, 5, true)
      if (not @apassed) and @twojump <= $game_variables[AIR_JUMP_VAR]
       
        if @twojump > 0
          $game_player.animation_id = AIR_JUMP_ANIMATION_ID
        elsif
          $game_player.animation_id = JUMP_ANIMATION_ID
        end

        @apassed = true
        @jumpnow = JUMP_MAX
        @twojump += 1

  $game_system.se_play(RPG::AudioFile.new(JUMP_SOUND, JUMP_VOLUME, JUMP_PITCH))
      else
        @jumpnow += 3       
      end
    else
      @apassed = false
    end
#-------------------------------------------------------------------------------
    if not $game_switches[GPLAT_DISABLE_SWITCH]
      @jumpnow -= 10
      if @jumpnow < 0
        actor = $game_party.actors[0]
        @character_name = actor.character_name #change graphic back to normal
        @jumpnow = [@jumpnow, -JUMP_MAX].max
        if not down1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, -@jumpnow, true)
          @jumpnow = 0
          @twojump = 0
        end
      elsif @jumpnow > 0
        actor = $game_party.actors[0]
        @character_name = actor.character_name + JUMP_SPRITE#change to jump graphic
        @jumpnow = [@jumpnow, JUMP_MAX].min
        if not up1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, @jumpnow, true)
          @jumpnow = 0
        end
      end
    end
end #unless   
    if Input.trigger?(Input::C)
      check_event_trigger_here([0])
      check_event_trigger_there([0,1,2])
    end
  end
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------
  def initialize
    @jumpnow = 0
    @twojump = 0
    @apassed = false
    @revise_x = 0
    @revise_y = 0
    @move == false
    super
  end
  #--------------------------------------------------------------------------
  # ● moving?
  #--------------------------------------------------------------------------
  def moving?
    unless @dot_m
      result = super
      return result
    end

    if @move_route_forcing
      if @move == false
        return false
      end
      super

    else
      return (@x != (@real_x / 128.0).round or @y != (@real_y / 128.0).round)
    end
  end
  #--------------------------------------------------------------------------
  # ● moving_a?
  #--------------------------------------------------------------------------
  def moving_a?
    if @move == false
      if (@move_route.list[@move_route_index].code <= 14 or
          @move_route.list[@move_route_index].code == 25)
        @move = true
      end
      return false
    end
    moving?
  end
  #--------------------------------------------------------------------------
  # ● update (jump)
  #--------------------------------------------------------------------------
  def update_jump

    @jump_count -= 1

    @real_x = (@real_x * @jump_count + @x * 128) / (@jump_count + 1)
    @real_y = (@real_y * @jump_count + @y * 128) / (@jump_count + 1)
    if @jump_count == 0
      @revise_x = 0
      @revise_y = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● move_type custom
  #--------------------------------------------------------------------------
  def move_type_custom
    unless @dot_m
      super
      return
    end

    if jumping? or moving_a?
      return
    end

    while @move_route_index < @move_route.list.size
      command = @move_route.list[@move_route_index]

      if command.code == 0
        if @move_route.repeat
          @move_route_index = 0
        end

        unless @move_route.repeat
          if @move_route_forcing and not @move_route.repeat
            @move_route_forcing = false
            @move_route = @original_move_route
            @move_route_index = @original_move_route_index
            @original_move_route = nil
          end

          @stop_count = 0
        end
        return
      end

      if command.code <= 14

        case command.code
        when 1 
          move_down
        when 2 
          move_left
        when 3 
          move_right
        when 4 
          move_up
        when 5 
          move_lower_left
        when 6 
          move_lower_right
        when 7 
          move_upper_left
        when 8 
          move_upper_right
        when 9 
          move_random
        when 10 
          move_toward_player
        when 11 
          move_away_from_player
        when 12 
          move_forward
        when 13 
          move_backward
        when 14 
          jump(command.parameters[0], command.parameters[1])
        end

        if not @move_route.skippable and not moving? and not jumping?
          return
        end
        @move_route_index += 1
        return
      end

      if command.code == 15
        @wait_count = command.parameters[0] * 2 - 1
        @move_route_index += 1
        return
      end

      if command.code >= 16 and command.code <= 26

        case command.code
        when 16 
          turn_down
        when 17 
          turn_left
        when 18 
          turn_right
        when 19 
          turn_up
        when 20 
          turn_right_90
        when 21 
          turn_left_90
        when 22 
          turn_180
        when 23 
          turn_right_or_left_90
        when 24 
          turn_random
        when 25 
          turn_toward_player
        when 26 
          turn_away_from_player
        end
        @move_route_index += 1
        return
      end

      if command.code >= 27

        case command.code
        when 27 
          $game_switches[command.parameters[0]] = true
          $game_map.need_refresh = true
        when 28 
          $game_switches[command.parameters[0]] = false
          $game_map.need_refresh = true
        when 29 
          @move_speed = command.parameters[0]
        when 30 
          @move_frequency = command.parameters[0]
        when 31 
          @walk_anime = true
        when 32 
          @walk_anime = false
        when 33 
          @step_anime = true
        when 34 
          @step_anime = false
        when 35 
          @direction_fix = true
        when 36 
          @direction_fix = false
        when 37 
          @through = true
        when 38 
          @through = false
        when 39 
          @always_on_top = true
        when 40 
          @always_on_top = false
        when 41 
          @tile_id = 0
          @character_name = command.parameters[0]
          @character_hue = command.parameters[1]
          if @original_direction != command.parameters[2]
            @direction = command.parameters[2]
            @original_direction = @direction
            @prelock_direction = 0
          end
          if @original_pattern != command.parameters[3]
            @pattern = command.parameters[3]
            @original_pattern = @pattern
          end
        when 42 
          @opacity = command.parameters[0]
        when 43 
          @blend_type = command.parameters[0]
        when 44 
          $game_system.se_play(command.parameters[0])
        when 45 
          result = eval(command.parameters[0])
        end
        @move_route_index += 1
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● move_down platform
  #--------------------------------------------------------------------------
  def move_down_p
    turn_down
    distance = 2 ** @move_speed
    down1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● move_down aaaagq
  #--------------------------------------------------------------------------
  def move_down_aaaagq
    distance = 2 ** @move_speed
    down1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● down1
  #--------------------------------------------------------------------------
  def down1(x, y, distance, down = false)
    result = down2(x, y, distance)
    if result == false
      @event_run = check_event_trigger_touch(x, y+1)
      return result
    end
    if @revise_x < -SIDE
      result = down2(x, y + 1, distance, 4)
      result &= down2(x - 1, y, distance)
      if result == false
        if down
          move_lower_right_p
          if @revise_x > SIDE
            @revise_x = SIDE
          end
        end
        return result
      end
    elsif @revise_x > SIDE
      result = down2(x, y + 1, distance, 6)
      result &= down2(x + 1, y, distance)
      if result == false
        if down
          move_lower_left_p
          if @revise_x < -SIDE
            @revise_x = -SIDE
          end
        end
        return result
      end
    end
    @revise_y += distance
    return result
  end
  #--------------------------------------------------------------------------
  # ● down2
  #--------------------------------------------------------------------------
  def down2(x, y, distance, d = 2)
    if @revise_y + distance > DOWN
      unless passable?(x, y, d)
        if @revise_y < DOWN
          @revise_y = DOWN
        end
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● move_left platform
  #--------------------------------------------------------------------------
  def move_left_p
    turn_left
    distance = 2 ** @move_speed
    left1(((@x * 128 + @revise_x) / 128.0).round,
          ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● left1
  #--------------------------------------------------------------------------
  def left1(x, y, distance, left = false)
    result = left2(x, y, distance)
    if result == false
      @event_run = check_event_trigger_touch(x-1, y)
      return result
    end
    if @revise_y < -UP and $game_switches[GPLAT_DISABLE_SWITCH]
      result = left2(x - 1, y, distance, 8)
      result &= left2(x, y - 1, distance)
      if result == false
        if left
          move_lower_left_p
          if @revise_y > DOWN
            @revise_y = DOWN
          end
        end
        return result
      end
    elsif @revise_y > DOWN and $game_switches[GPLAT_DISABLE_SWITCH]
      result = left2(x - 1, y, distance, 2)
      result &= left2(x, y + 1, distance)
      if result == false
        if left
          move_upper_left_p
          if @revise_y < -UP
            @revise_y = -UP
          end
        end
        return result
      end
    end
    @revise_x -= distance
    return result
  end
  #--------------------------------------------------------------------------
  # ● left2
  #--------------------------------------------------------------------------
  def left2(x, y, distance, d = 4)
    if @revise_x - distance < -SIDE
      unless passable?(x, y, d)
        if @revise_x > -SIDE
          @revise_x = -SIDE
        end
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● move_right platform
  #--------------------------------------------------------------------------
  def move_right_p
      turn_right
    distance = 2 ** @move_speed
    right1(((@x * 128 + @revise_x) / 128.0).round,
            ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● right1
  #--------------------------------------------------------------------------
  def right1(x, y, distance, right = false)
    result = right2(x, y, distance)
    if result == false
      @event_run = check_event_trigger_touch(x+1, y)
      return result
    end
    if @revise_y < -UP and $game_switches[GPLAT_DISABLE_SWITCH]
      result = right2(x + 1, y, distance, 8)
      result &= right2(x, y - 1, distance)
      if result == false
        if right
          move_lower_right_p
          if @revise_y > DOWN
            @revise_y = DOWN
          end
        end
        return result
      end
    elsif @revise_y > DOWN and $game_switches[GPLAT_DISABLE_SWITCH]
      result = right2(x + 1, y, distance, 2)
      result &= right2(x, y + 1, distance)
      if result == false
        if right
          move_upper_right_p
          if @revise_y < -UP
            @revise_y = -UP
          end
        end
        return result
      end
    end
    @revise_x += distance
    return result
  end
  #--------------------------------------------------------------------------
  # ● right2
  #--------------------------------------------------------------------------
  def right2(x, y, distance, d = 6)
    if @revise_x + distance > SIDE
      unless passable?(x, y, d)
        if @revise_x < SIDE
          @revise_x = SIDE
        end
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● move_up platform
  #--------------------------------------------------------------------------
  def move_up_p
    turn_up
    distance = 2 ** @move_speed
    up1(((@x * 128 + @revise_x) / 128.0).round,
        ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● move_up_aaaagq
  #--------------------------------------------------------------------------
  def move_up_aaaagq
    distance = 2 ** @move_speed
    up1(((@x * 128 + @revise_x) / 128.0).round,
        ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  end
  #--------------------------------------------------------------------------
  # ● up1
  #--------------------------------------------------------------------------
  def up1(x, y, distance, up = false)
    result = up2(x, y, distance)
    if result == false
      @event_run = check_event_trigger_touch(x, y-1)
      return result
    end
    if @revise_x < -SIDE
      result = up2(x, y - 1, distance, 4)
      result &= up2(x - 1, y, distance)
      if result == false
        if up
          move_upper_right_p
          if @revise_x > SIDE
            @revise_x = SIDE
          end
        end
        return result
      end
    elsif @revise_x > SIDE
      result = up2(x, y - 1, distance, 6)
      result &= up2(x + 1, y, distance)
      if result == false
        if up
          move_upper_left_p
          if @revise_x < -SIDE
            @revise_x = -SIDE
          end
        end
        return result
      end
    end
    @revise_y -= distance
    return result
  end
  #--------------------------------------------------------------------------
  # ● up2
  #--------------------------------------------------------------------------
  def up2(x, y, distance, d = 8)
    if @revise_y - distance < -UP
      unless passable?(x, y, d)
        if @revise_y > -UP
          @revise_y = -UP
        end
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ● low_left platform
  #--------------------------------------------------------------------------
  def move_lower_left_p
    unless @direction_fix
      @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
    end
    distance = (2 ** @move_speed) / Math.sqrt(2)
    if @direction == 2
      turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_down if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 2, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_y > DOWN and -UP > @revise_y - distance
          @revise_y = DOWN
        end
        turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_left if @event_run
      end
    else
      turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_left if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 4, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if  @revise_x + distance> SIDE and -SIDE > @revise_x
          @revise_x = -SIDE
        end
        turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_down if @event_run
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● low_right platform
  #--------------------------------------------------------------------------
  def move_lower_right_p
    unless @direction_fix
      @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
    end
    distance = (2 ** @move_speed) / Math.sqrt(2)
    if @direction == 2
      turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_down if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 2, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_y > DOWN and -UP > @revise_y - distance
          @revise_y = DOWN
        end
        turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_right if @event_run
      end
    else
      turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_right if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 6, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_x > SIDE and -SIDE > @revise_x - distance
          @revise_x = SIDE
        end
        turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_down if @event_run
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● up_left platform
  #--------------------------------------------------------------------------
  def move_upper_left_p
    unless @direction_fix
      @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
    end
    distance = (2 ** @move_speed) / Math.sqrt(2)
    if @direction == 8
      turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
                            ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_up if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 8, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_y + distance > DOWN and -UP > @revise_y
          @revise_y = -UP
        end
        turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_left if @event_run
      end
    else
      turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
                            ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_left if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 4, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_x > SIDE and -SIDE > @revise_x - distance
          @revise_x = SIDE
        end
        turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_up if @event_run
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● up_right platform
  #--------------------------------------------------------------------------
  def move_upper_right_p
    unless @direction_fix
      @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
    end
    distance = (2 ** @move_speed) / Math.sqrt(2)
    if @direction == 8
      turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
                            ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_up if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 8, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_y + distance > DOWN and -UP > @revise_y
          @revise_y = -UP
        end
        turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_right if @event_run
      end
    else
      turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
                            ((@y * 128 + @revise_y) / 128.0).round, distance)
      turn_right if @event_run
      unless @event_run
        if last_move?(@real_x, @real_y, 6, distance)
          result = check_event_trigger_here([1,2], false)
          if result == true
            return
          end
        end
        move_on
        if @revise_x > SIDE and -SIDE > @revise_x - distance
          @revise_x = SIDE
        end
        turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
                              ((@y * 128 + @revise_y) / 128.0).round, distance)
        turn_up if @event_run
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● check event here
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers, run = true)
    result = false
    if $game_system.map_interpreter.running?
      return result
    end
    for event in $game_map.events.values
      if event.x == ((@x * 128 + @revise_x) / 128.0).round and
          event.y == ((@y * 128 + @revise_y) / 128.0).round and
          triggers.include?(event.trigger)
        if not event.jumping? and event.over_trigger?
          if event.list.size > 1
            if run == true
              event.start
            end
            result = true
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # ● move_on
  #--------------------------------------------------------------------------
  def move_on
    if @y < (@y + @revise_y / 128.0).round
      @y += 1
      @revise_y -= 128
    end
    if @x > (@x + @revise_x / 128.0).round
      @x -= 1
      @revise_x += 128
    end
    if @x < (@x + @revise_x / 128.0).round
      @x += 1
      @revise_x -= 128
    end
    if @y > (@y + @revise_y / 128.0).round
      @y -= 1
      @revise_y += 128
    end
  end
  #--------------------------------------------------------------------------
  # ● update (anime)
  #--------------------------------------------------------------------------
  def anime_update
    if @walk_anime
      @anime_count += 1.5
    elsif @step_anime
      @anime_count += 1
    end
    if @anime_count > 18 - @move_speed * 2 #@event = 4?
      if not @step_anime and @stop_count > 0
        @pattern = @original_pattern
      else
        @pattern = (@pattern + 1) % 4
      end
      @anime_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● moveto (x,y)
  #--------------------------------------------------------------------------
  alias :moveto_original :moveto
  def moveto(x, y)
    @revise_x = 0
    @revise_y = 0
    moveto_original(x, y)
  end
  #--------------------------------------------------------------------------
  # ● last move?
  #--------------------------------------------------------------------------
  def last_move?(x, y, direction, distance)
    if direction == 2 or direction == 6
      distance *= -1
    end
    if (direction == 2 or direction == 8) and
        (y / 128.0).round != ((y - distance) / 128.0).round
      return true
    end
    if (direction == 4 or direction == 6) and
        (x / 128.0).round != ((x - distance) / 128.0).round
      return true
    end
    return false
  end
end

#==============================================================================
# Game_Character
#==============================================================================

class Game_Character
 
    include G101_GPLAT

  def update_move
    distance = 2 ** @move_speed
    if @x * 128 != @real_x and @y * 128 != @real_y
      distance /= Math.sqrt(2)
    end
    if @y * 128 > @real_y
      @real_y = [@real_y + distance, @y * 128].min
    end
    if @x * 128 < @real_x
      @real_x = [@real_x - distance, @x * 128].max
    end
    if @x * 128 > @real_x
      @real_x = [@real_x + distance, @x * 128].min
    end
    if @y * 128 < @real_y
      @real_y = [@real_y - distance, @y * 128].max
    end
    if @walk_anime
      @anime_count += 1.5
    elsif @step_anime
      @anime_count += 1
    end
  end
end

#==============================================================================
# Game_Event
#==============================================================================

class Game_Event < Game_Character
  def start
    if @list.size > 1
      if $game_player.event != 0
        $game_player.move_speed = $game_player.event
      end
      @starting = true
    end
  end
end
#end of script ^,^




Known Compatibility Issues
? ~ let me know...




Restrictions

Do not post this script on any other site.

must give credit to www.gameface101.com
cogwheel for pixel movement

special thanks to mr_wiggles and moghunter for RGSS support


*looking for event gravity?
Event Gravity Script (GPLAT 2 of 2)

EDIT: 7/18/2011

see this script in action

http://gameface101.playogame.com/t1059-super-mockup-brothers-rmxp-platformer-starter#15042


Enjoy! ^,^
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
C.O.R.N.
C.O.R.N.
#2 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

BluE

C.O.R.N.
C.O.R.N.
C.O.R.N.
profile
I tested it out and it's smoother and simpler than Pythagoras Theorem. I really like how simple the options are but at the same time manage to make really complex looking results. Especially liked how you jump higher when you hold down the jump button. Just two questions; How do you make a platform and What is "air jump" options for?
Sweet work G@MeF@Ce!
C.O.R.N.
Show Signature


Want a real challenge? Try Crack this code!

If you read this message, please PM me. this is a test. And I'm serious, this isnt just some lousy time wasting paragraph that I wrote just to fill in my signature. It's here for a reason. PM ME.
C.O.R.N.
http://51s-seedy-masteroogway.blogspot.com
Administrator
Administrator
#3 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
Blue wrote:Just two questions; How do you make a platform and What is "air jump" options for?
Sweet work G@MeF@Ce![/color]

to make a platform, simply make that tile on your tileset
impassable.

RMXP > F9 > Tileset tab > Passage

make the tile you are using for the platform an "X" and not an "O"


the air jump is simply controlled by the variable you choose
set the value to 2 for a double jump, 3 for a triple jump

Pythagoras Theorem Razz

add another angle for simple squares ^,^


Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
C.O.R.N.
C.O.R.N.
#4 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

BluE

C.O.R.N.
C.O.R.N.
C.O.R.N.
profile
That seems easy enough. THanks
C.O.R.N.
Show Signature


Want a real challenge? Try Crack this code!

If you read this message, please PM me. this is a test. And I'm serious, this isnt just some lousy time wasting paragraph that I wrote just to fill in my signature. It's here for a reason. PM ME.
C.O.R.N.
http://51s-seedy-masteroogway.blogspot.com
Administrator
Administrator
#5 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
new script version 1.1
(fixed an event check error)

starter kit has been released!!!

see original post

gameface
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
Administrator
Administrator
#6 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
minor update: v1.2 in original post

can not jump when message window is open Very Happy

Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#7 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
I have one question:
how to make attack using event if I use platformer script?
please answer.
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#8 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
^Rmxp22 - welcome to the underground.

check out the mockup brothers demo to see how the events were made here:

http://gameface101.playogame.com/?pid=18

If you are looking to make a shooting platformer, the new X-plat project will be out soon enough, you can check out the old version here:

http://gameface101.playogame.com/?pid=10
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#9 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
Can you upload the game at another website because I can't download it at mediafire.

If you can't upload the game at another website,can you just tell me how the events were made?
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#10 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
hmm... any reason why mediafire won't work for you?
remember to click on "skip ads" on the top right to get to the download link.

I have not tried file dropper before, give this a try, let me know if it works ^,^


Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#11 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
When I put the password,I click the unlock button.Then the page automatic reload.

But,the new link you give works.Thanks
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#12 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
When I Extract the file no application or folder I found,but why.The KB of the zip file I extract is 288.

Is that the zip file is 288 KB?
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#13 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
When I extract the file it say "The archive is either in unknown format or demaged"
Please help.
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#14 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
hmm.. shouldn't be that small it's like 9-10mb

what browser are you using, maybe virus protection preventing pop-us?

don't save the link, save the link as.

here I'll try another upload

and send it to you via PM

keep your eye out for one of these under the header




EDIT: 5-6mb

edit::sure, they were made with conditional branches and jump to labels ~ some tricky eventing it was... that's why I recommend looking at the demo, sent you a pm ~ did it work?

Naruto eh? http://gameface101.playogame.com/t356-naruto-spam
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#15 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

Rmxp22

ACTIVATED
ACTIVATED
ACTIVATED
profile
Thanks.It works great.

Another question:
how did you change the application icon.
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#16 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
@Rmxp22 - mr_wiggles made a tutorial here about "resource_hacker"

that's how you edit and make the icon for your project.

@,@ - looking.....

I know the events are a bit complex, I'll be certain to make better comments next version of the project.
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#17 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

FireBlast

ACTIVATED
ACTIVATED
ACTIVATED
profile
Cool script.How about enemies?
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#18 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

godobladla

ACTIVATED
ACTIVATED
ACTIVATED
profile
Hi! Can I use the scripts with Blizz-ABS? I want some parts in my game where you must go to the other side through a platform to activate the "key"(bridge, delete wall, etc) so the friends can go through and again fight together.
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#19 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
FireBlast wrote:Cool script.How about enemies?
@FireBlast - don't know how I missed your post ~ ?

the enemies are setup through some advanced eventing,
in the future I hope to have it all in script then simply label the events that you want to be an enemy, item, or block etc...


godobladla wrote:Hi! Can I use the scripts with Blizz-ABS? I want some parts in my game where you must go to the other side through a platform to activate the "key"(bridge, delete wall, etc) so the friends can go through and again fight together.

@godobladla - not a bad idea :~D this could also be done through some advanced eventing....well you would have to make some serious edits to Blizzard's scripts to use these scripts with Blizz-ABS, however the next version of the Xplat project will be released soon. It's basically Gplat with XAS ^,^
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#20 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

SpriteZilla

ACTIVATED
ACTIVATED
ACTIVATED
profile
These two scripts are so perfect. If you tell me you have a collision detection script I'm gonna crap my pants! Very well done man. I'm impressed. This is a great script.
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#21 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
G@MeF@Ce wrote:@Rmxp22 - mr_wiggles made a tutorial here about "resource_hacker"

Member the global mods took it down cause they thought it was "hacking" and its illegal. :/
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#22 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
^ o I know ~ but it's so cool to use just to change the graphic for the icon ^^ gives your project more of a touch. I think it was the link that was the issue, I know you can still find it on cnet/downloads...

Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#23 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

darkscypher

ACTIVATED
ACTIVATED
ACTIVATED
profile
is it possible to toggle the PIXEL_MOVE true option in game with event script between true or false? like some parts don't use the PIXEL_MOVE so leave it as FALSE but if you are in another map that is platforming switch it to TRUE?
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#24 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
yo darkscypher,

if some maps are not platform and some are, why not toggle by switch?

or are you also looking to keep the gravity but toggle the pixel movement and jump??
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#25 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

darkscypher

ACTIVATED
ACTIVATED
ACTIVATED
profile
yes, i'm looking to keep the gravity but toggle pixel movement and jump. is this possible?
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#26 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
not how the script is currently written, :~/
some rewriting and changing PIXEL_MOVE to a global variable so that one could access via event would make it possible. Cool
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#27 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

darkscypher

ACTIVATED
ACTIVATED
ACTIVATED
profile
Gameface if you can do this for me i'll be in your debt i'm very good at photoshop work!!! the game i'm currently working on i've been working on it for 2 years and i wanted to add a platforming element to it to add a little extra spice.
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#28 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
well then I will take a swing at it, I haven't been in scripting mode so it may take some time, I'm certain to improve wherever I left off +



Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#29 Re: RMXP = Pixel Platformer (GPLAT 1 of 2)
Loading

darkscypher

ACTIVATED
ACTIVATED
ACTIVATED
profile
thanks gameface hoping to hear from you soon
ACTIVATED
Show Signature
ACTIVATED

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled