Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Battle Parallax Background
- # Version: 1.0
- # Author: DiamondandPlatinum3
- # Date: September 6, 2012
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Description:
- #
- # This script allows you to use a parallax as a background for your
- # Battles. It also allows you to scroll the parallax like any regular
- # map parallax.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #------------------------------------------------------------------------------
- # Instructions:
- #
- # ~ The method to alter the battle parallax is to use a script call with
- # the following line of code
- #
- # setbattleparallax( filename, scrollx, scrolly )
- #
- # Where 'filename' is where you enter the name of the parallax, this must
- # be done in quotation marks ( " " ).
- # 'scrollx' is the amount the parallax will scroll to the left or right.
- # 'scrolly' is the amount the parallax will scroll up or down.
- #
- #
- # - If you do not want to change a specific value, simply pass in nil as the
- # parameter
- #
- #
- # - You can find screenshots to visually explain the method
- # Here: http://img4host.net/upload/07161945504a02819c6ec.png
- #
- #
- # - You can also use negative numbers to reverse the directions of the
- # parallax scroll. You'll need to play around with it to achieve the
- # desired effect
- #
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- #
- #
- # THERE IS NO EDITABLE REGION TO THIS SCRIPT
- #
- #==============================================================================
- #==============================================================================
- # ** Spriteset_Battle
- #------------------------------------------------------------------------------
- # This class brings together battle screen sprites. It's used within the
- # Scene_Battle class.
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # * Overwritten Functions
- #--------------------------------------------------------------------------
- # create_battleback
- # update_battleback
- # dispose_battleback_bitmap
- # dispose_battleback
- #
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- alias dp3_batlparallax_sprsetbatl_init_1h2g initialize
- alias dp3_batlparallax_sprsetbatl_dispose_1h2g dispose
- alias dp3_batlparallax_sprsetbatl_update_1h2g update
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- # Call Original Method
- dp3_batlparallax_sprsetbatl_init_1h2g
- create_parallax
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- update_parallax
- # Call Original Method
- dp3_batlparallax_sprsetbatl_update_1h2g
- end
- #--------------------------------------------------------------------------
- # * Free
- #--------------------------------------------------------------------------
- def dispose
- dispose_parallax
- # Call Original Method
- dp3_batlparallax_sprsetbatl_dispose_1h2g
- end
- #--------------------------------------------------------------------------
- # * Create Battle Background (Floor) Sprite
- #--------------------------------------------------------------------------
- def create_battleback
- @battleback_sprite = nil
- end
- #--------------------------------------------------------------------------
- # * Create Parallax
- #--------------------------------------------------------------------------
- def create_parallax
- @backparallax = Plane.new(@viewport1)
- @backparallax.bitmap = Cache.parallax($game_system.battleparallaxgraphicname)
- @backparallax.z = 0
- end
- #--------------------------------------------------------------------------
- # * Update Battle Background (Floor) Sprite
- #--------------------------------------------------------------------------
- def update_battleback
- @battleback_sprite.update if @battleback_sprite
- end
- #--------------------------------------------------------------------------
- # * Update Parallax
- #--------------------------------------------------------------------------
- def update_parallax
- if @backparallax
- @backparallax.ox += $game_system.battleparallaxgraphicscrollx
- @backparallax.oy += $game_system.battleparallaxgraphicscrolly
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose of Battleback Bitmap
- #--------------------------------------------------------------------------
- def dispose_battleback_bitmap
- @battleback_sprite.bitmap.dispose if @battleback_sprite
- end
- #--------------------------------------------------------------------------
- # * Dispose of Battleback Sprite
- #--------------------------------------------------------------------------
- def dispose_battleback
- @battleback_sprite.dispose if @battleback_sprite
- end
- #--------------------------------------------------------------------------
- # * Free Battle Parallax
- #--------------------------------------------------------------------------
- def dispose_parallax
- @backparallax.dispose if @backparallax
- end
- end # of Class
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system data. It saves the disable state of saving and
- # menus. Instances of this class are referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # * New Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :battleparallaxgraphicname
- attr_accessor :battleparallaxgraphicscrollx
- attr_accessor :battleparallaxgraphicscrolly
- #--------------------------------------------------------------------------
- # * Alias Listings
- #--------------------------------------------------------------------------
- alias dp3_batlparallax_gamesys_init_1h2g initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- # Call Original Method
- dp3_batlparallax_gamesys_init_1h2g
- # Setup Parallax (safety precautions in case the user doesn't do it themselves)
- @battleparallaxgraphicname = "BlueSky"
- @battleparallaxgraphicscrollx = 0
- @battleparallaxgraphicscrolly = 0
- end
- end # of Class
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Set Battle Parallax
- #--------------------------------------------------------------------------
- def setbattleparallax( filename, scrollx, scrolly )
- $game_system.battleparallaxgraphicname = filename if filename.is_a?(String)
- $game_system.battleparallaxgraphicscrollx = scrollx if scrollx.is_a?(Integer)
- $game_system.battleparallaxgraphicscrolly = scrolly if scrolly.is_a?(Integer)
- end
- end # of Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement