In a nutshell, the script takes and old map and slides it off in a direction, and slides the new map next to it, giving a seamless pan like that you see in Zelda Link to the Past, Metroid when you enter doors, and so on. It's handy.
Script
CODE
#==============================================================================
# ** Night_Runner's Map Sliding
#------------------------------------------------------------------------------
# History:
# Date Created: 15/Dec/10
# Created for: Rimrook
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=46950
#
# Description:
# This script allows the designer to seamlessly slide between maps
#
# How to Install:
# Meh.
#
# How to Use:
# Line 97 defines the speed at which the maps slide
# To call this, have an event run the code:
# $game_temp.transition_slide = 2
# where 2 is the direction of the new map (see your numpad), and then
# run a transfer player as normal.
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# Edited to keep a flag if the sliding transition needs to keep the spritemap,
# and has a integer to track the direction of the sliding map.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_initialize initialize unless $@
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :keep_map
attr_accessor :transition_slide
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
# alias nr_transmap_initialize initialize unless $@
def initialize(*args)
@keep_map = false
@transition_slide = false
return nr_transmap_initialize(*args)
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# Edited to allow movement of the viewports rectangles, and to not
# dispose the map if the sliding transition needs it.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_dispose dispose unless $@
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
# alias nr_transmap_dispose dispose unless $@
def dispose(*args)
return if $game_temp.keep_map
return nr_transmap_dispose(*args)
end
#--------------------------------------------------------------------------
# * Rect=(Dimensions)
#--------------------------------------------------------------------------
def rect=(*args)
@viewport1.rect = *args
@viewport2.rect = *args
@viewport3.rect = *args
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# Edited to keep the old and new map, and slide between them.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Constant
#--------------------------------------------------------------------------
SPEED = 30
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_transfer_player transfer_player unless $@
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player(*args)
# If sliding
if [2, 4, 6, 8].include?($game_temp.transition_slide)
# Backup the current spriteset
old_spriteset = @spriteset.dup
# Cancel disposing the spriteset
$game_temp.keep_map = true
# Don't transition into the new, map, we're going to slide.
$game_temp.transition_processing = false
# Run original transfer_player
nr_transmap_transfer_player(*args)
# Do the main processing
case $game_temp.transition_slide
when 2 # Slide new map up
# Reposition the spriteset
@spriteset.rect = Rect.new(0, 640, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..480 / SPEED
old_spriteset.rect = Rect.new(0, -i * SPEED, 640, 480)
@spriteset.rect = Rect.new(0, 480 - i * SPEED, 640, 480)
Graphics.update
end
when 4 # Slide new map right
# Reposition the spriteset
@spriteset.rect = Rect.new(-640, 0, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..640 / SPEED
old_spriteset.rect = Rect.new(i * SPEED, 0, 640, 480)
@spriteset.rect = Rect.new(-640 + i * SPEED, 0, 640, 480)
Graphics.update
end
when 6 # Slide new map left
# Reposition the spriteset
@spriteset.rect = Rect.new(640, 0, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..640 / SPEED
old_spriteset.rect = Rect.new(-i * SPEED, 0, 640, 480)
@spriteset.rect = Rect.new(640 - i * SPEED, 0, 640, 480)
Graphics.update
end
when 8 # Slide new map down
# Reposition the spriteset
@spriteset.rect = Rect.new(0, -480, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..480 / SPEED
old_spriteset.rect = Rect.new(0, i * SPEED, 640, 480)
@spriteset.rect = Rect.new(0, -480 + i * SPEED, 640, 480)
Graphics.update
end
end
# Force the map to position
@spriteset.rect = Rect.new(0, 0, 640, 480)
# Dispose the old spritemap
$game_temp.keep_map = false
GC.start
$game_temp.transition_slide = false
# If not sliding
else
# Run original transfer_player
return nr_transmap_transfer_player(*args)
end
end
end
# ** Night_Runner's Map Sliding
#------------------------------------------------------------------------------
# History:
# Date Created: 15/Dec/10
# Created for: Rimrook
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=46950
#
# Description:
# This script allows the designer to seamlessly slide between maps
#
# How to Install:
# Meh.
#
# How to Use:
# Line 97 defines the speed at which the maps slide
# To call this, have an event run the code:
# $game_temp.transition_slide = 2
# where 2 is the direction of the new map (see your numpad), and then
# run a transfer player as normal.
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# Edited to keep a flag if the sliding transition needs to keep the spritemap,
# and has a integer to track the direction of the sliding map.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_initialize initialize unless $@
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :keep_map
attr_accessor :transition_slide
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
# alias nr_transmap_initialize initialize unless $@
def initialize(*args)
@keep_map = false
@transition_slide = false
return nr_transmap_initialize(*args)
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# Edited to allow movement of the viewports rectangles, and to not
# dispose the map if the sliding transition needs it.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_dispose dispose unless $@
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
# alias nr_transmap_dispose dispose unless $@
def dispose(*args)
return if $game_temp.keep_map
return nr_transmap_dispose(*args)
end
#--------------------------------------------------------------------------
# * Rect=(Dimensions)
#--------------------------------------------------------------------------
def rect=(*args)
@viewport1.rect = *args
@viewport2.rect = *args
@viewport3.rect = *args
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# Edited to keep the old and new map, and slide between them.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Constant
#--------------------------------------------------------------------------
SPEED = 30
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_transmap_transfer_player transfer_player unless $@
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player(*args)
# If sliding
if [2, 4, 6, 8].include?($game_temp.transition_slide)
# Backup the current spriteset
old_spriteset = @spriteset.dup
# Cancel disposing the spriteset
$game_temp.keep_map = true
# Don't transition into the new, map, we're going to slide.
$game_temp.transition_processing = false
# Run original transfer_player
nr_transmap_transfer_player(*args)
# Do the main processing
case $game_temp.transition_slide
when 2 # Slide new map up
# Reposition the spriteset
@spriteset.rect = Rect.new(0, 640, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..480 / SPEED
old_spriteset.rect = Rect.new(0, -i * SPEED, 640, 480)
@spriteset.rect = Rect.new(0, 480 - i * SPEED, 640, 480)
Graphics.update
end
when 4 # Slide new map right
# Reposition the spriteset
@spriteset.rect = Rect.new(-640, 0, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..640 / SPEED
old_spriteset.rect = Rect.new(i * SPEED, 0, 640, 480)
@spriteset.rect = Rect.new(-640 + i * SPEED, 0, 640, 480)
Graphics.update
end
when 6 # Slide new map left
# Reposition the spriteset
@spriteset.rect = Rect.new(640, 0, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..640 / SPEED
old_spriteset.rect = Rect.new(-i * SPEED, 0, 640, 480)
@spriteset.rect = Rect.new(640 - i * SPEED, 0, 640, 480)
Graphics.update
end
when 8 # Slide new map down
# Reposition the spriteset
@spriteset.rect = Rect.new(0, -480, 640, 480)
# Transition over
Graphics.transition(0)
# Slide the spritesets
for i in 0..480 / SPEED
old_spriteset.rect = Rect.new(0, i * SPEED, 640, 480)
@spriteset.rect = Rect.new(0, -480 + i * SPEED, 640, 480)
Graphics.update
end
end
# Force the map to position
@spriteset.rect = Rect.new(0, 0, 640, 480)
# Dispose the old spritemap
$game_temp.keep_map = false
GC.start
$game_temp.transition_slide = false
# If not sliding
else
# Run original transfer_player
return nr_transmap_transfer_player(*args)
end
end
end