Parallax Horizon

0 Members and 1 Guest are viewing this topic.

Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best RPG Maker User (Scripting)2010 Most Mature Member
Parallax Horizon
Version: 1.0
Author: modern algebra
Date: August 2, 2008

Version History

  • <Version 1.0> August 2 2008 - Original Release


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 to which the player is moving.


  • Allows you to set the parallax to have an illusory horizon
  • Allows you to set the speed map by map
  • Scrolls only in the opposite direction of the way you are moving, while you are moving.
  • Is completely compatible with the default scrolling, so that you can even combine the two.
  • Supports dashing, so the speed you set is doubled when the player is dashing, so the parallax is moving at the correct speed always.


Not applicable


See inside the script for instructions


Code: [Select]
#  Parallax Horizon
#  Version 1.0
#  Author: modern algebra (
#  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
        #  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 1 then 10
      # Modify the scrolling
      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
        @parallax_sx += mod if $game_player.x * 256 > $game_player.real_x
        @parallax_sy -= mod if $game_player.y * 256 < $game_player.real_y
        @parallax_sy += mod if $game_player.y * 256 > $game_player.real_y
    # 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
    # Run Original Method


  • modern algebra


  • arclight, for requesting this useful script


Please post here at for the swiftest response


Not really necessary.

Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:54:17 PM by Modern Algebra »