#==============================================================================
# Parallax Horizon
# Version 1.0
# Author: modern algebra (rmrk.net)
# Date: August 2, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Description:
# This script allows you to set a speed for a parallax to scroll extra
# when the player is moving. It will scroll in the opposite direction, to
# give the illusion of a horizon.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# To make it so that the parallax will scroll, you must check the box in the
# map settings for it to scroll, even if you do not want it to scroll
# regularly. You can avoid it scrolling regularly by leaving the scroll value
# at 0. For instructions on setting up the maps, see the CONFIGURABLE REGION
# at line 49. You can also use this code:
#
# $game_map.p_scroll_mod =
#
# to set the speed manually in game. It will reset once you leave the map.
#==============================================================================
# ** Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new public instance variable - p_scroll_mod
# aliased method - update_parallax
#==============================================================================
class Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :p_scroll_mod
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Parallax
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_arclg_req_parallax_moving_response_53b6 update_parallax
def update_parallax
# IF player is moving and parallax stats not updated yet
if $game_player.moving? && @old_parallax_sx == nil
# Set variables to save the default values of parallax stats
@old_parallax_sx = @parallax_sx
@old_parallax_sy = @parallax_sy
# Initialize scroll modifier
if @p_scroll_mod == nil
@p_scroll_mod = case map_id
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# CONFIGURABLE REGION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# To configure this script, set up the lines below like this:
#
# when map_id then scroll_speed
#
# So if you set:
# when 1 then 10
#
# That means that the parallax on Map with ID 1 will scroll at
# speed 10 in the opposite direction when the player is moving.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
when 84 then 10
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END CONFIGURABLE REGION (height - 20) * 256 / 2
#//////////////////////////////////////////////////////////////////
else
0
end
end
# Modify the scrolling
#if @display_y > (height - 20) * 256 / 3 or @display_y < (height - 20) * 256 / 6
if @p_scroll_mod != 0
# Adjust for dashing
mod = $game_player.dash? ? @p_scroll_mod*2 : @p_scroll_mod
# Adjust scroll in the direction the player is moving
@parallax_sx -= mod if $game_player.x * 256 < $game_player.real_x if @display_x > 32 #and @display_x < @map.width * 32 + 768
@parallax_sx += mod if $game_player.x * 256 > $game_player.real_x if @display_x > 32 #and @display_x < @map.width * 32 + 768
@parallax_sy -= mod if $game_player.y * 256 < $game_player.real_y if @display_y > @map.height * 32 / 20 and @display_y < @map.height * 32 * 1.9#1216
@parallax_sy += mod if $game_player.y * 256 > $game_player.real_y if @display_y > @map.height * 32 / 20 and @display_y < @map.height * 32 * 1.9#1216
end
# Restore Parallax Scroll to default if not moving
elsif @old_parallax_sx != nil
@parallax_sx = @old_parallax_sx
@parallax_sy = @old_parallax_sy
@old_parallax_sx = nil
@old_parallax_sy = nil
end
# Run Original Method
modalg_arclg_req_parallax_moving_response_53b6
end
end