RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] Movement in RPG

Started by Brotherh0od, October 17, 2006, 12:24:32 AM

0 Members and 1 Guest are viewing this topic.

Brotherh0od

i was wondering if anyone could tell me how to have my character move like Link in those Zelda RPGs.. :)
ARGH!!!!!

Arrow

Like what, the way he moves from screen to screen? Cuz I have a script for that.

Brotherh0od

that and the way he could move diagonally and not just like the four primary directions. (Up ,down, right, left)
ARGH!!!!!

Arrow

There's a good diagonals script in the script section. It was made by a guy from Japan, I think. If you have the right topic there should be a post that says bump. Just do what it says there. HERE is the scroll script. Just make a really big map, and every couple of steps it scrolss for you, LTTP style.Remember, inser all scripts above main.

#==============================================================================
# ¡ Zelda-Style Map Scrolling
#------------------------------------------------------------------------------
# Script by Minkoff
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # œ Update
  #--------------------------------------------------------------------------
  def update
    last_moving = moving?
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing or @disable_input
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
     when 6
        move_right
      when 8
        move_up
      end
    end
    super
    #------------------------------------------------------------------------
    if @direction == 6 and # Player Facing Right
    @real_x % 2560 == 0 and
    @real_x > $game_map.display_x and
    $game_map.display_x != @last_display_x
      @last_display_x = $game_map.display_x
      $game_map.scroll_right(128)
      @disable_input = true
    elsif @direction == 4 and # Player Facing Left
    @real_x % (2560 - 128) == 0 and
    ($game_map.display_x - @real_x).abs < (2560 - 128) and
    $game_map.display_x != @last_display_x
      @last_display_x = $game_map.display_x
      $game_map.scroll_left(128)
      @disable_input = true
    elsif @direction == 2 and # Player Facing Down
    @real_y % 1920 == 0 and
    @real_y > $game_map.display_y and
    $game_map.display_y != @last_display_y
      @last_display_y = $game_map.display_y
      $game_map.scroll_down(128)
      @disable_input = true
    elsif @direction == 8 and # Player Facing Up
    @real_y % (1920 - 128) == 0 and
    ($game_map.display_y - @real_y).abs < (1920 - 128) and
    $game_map.display_y != @last_display_y
      @last_display_y = $game_map.display_y
      $game_map.scroll_up(128)
      @disable_input = true
    else
      @disable_input = false
      @last_display_x = nil
      @last_display_y = nil
    end
    #------------------------------------------------------------------------
    unless moving?
      if last_moving
        result = check_event_trigger_here([1,2])
        if result == false
          unless $DEBUG and Input.press?(Input::CTRL)
            if @encounter_count > 0
              @encounter_count -= 1
            end
          end
        end
      end
      if Input.trigger?(Input::C)
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
end