Kain Nobel
Member
Map : Scroll Panorama
Version: 3.5
By: Kain Nobel
Introduction
I think the title should be description enough, but if not I'll explain what it does. Basically, this allows you to scroll the panorama's (background image that appears behind your maps) ox and oy coordinates. Although, you must find the proper kind of panoramas to do this with otherwise it won't look right :P
Coinidentally, that ever rampant RTP that alot of us are sick of seeing were smart and already gave us 7 panoramas which scroll beautifully! 3 of them scroll horizontally AND vertically equally as good, and the other 4 only scroll horizontally so it gave me a new respect for panoramas
Screenshots
I'd have to post an animated .gif and quite frankly I don't think I have a program that does that, sorry :P
Script
Instructions
Place below SDK and above Main. Requires the Spriteset_Map#update method split, but if you're crafty you'll know what lines to replace in the default code to get this effect so you don't need SDK
FAQ
Compatibility
SDK Required, Spriteset_Map#update_panorama_plane method. Alternatively, you can go into the default Spriteset_Map class and place the entire method directly underneath line 122. Thats all the help I can give you for non-SDK so please don't ask me :P
Credits and Thanks
Thanks Enterbrain for the beautiful panoramas that scroll nicely from end to end
Thanks Capcom for making TMNT IV which shows an example of scrolling panorama
Terms and Conditions
Free to use in commercial and non-commercial work, please credit me if you do so :thumb:
Version: 3.5
By: Kain Nobel
Introduction
I think the title should be description enough, but if not I'll explain what it does. Basically, this allows you to scroll the panorama's (background image that appears behind your maps) ox and oy coordinates. Although, you must find the proper kind of panoramas to do this with otherwise it won't look right :P
No, I didn't create this, its just a video of Teenage Mutant Ninja Turtles IV on the SNES. But this script is intended for things like what you can see in the background in approx 0:20 seconds...
http://www.youtube.com/watch?v=lsuOhBdKB2w
http://www.youtube.com/watch?v=lsuOhBdKB2w
Coinidentally, that ever rampant RTP that alot of us are sick of seeing were smart and already gave us 7 panoramas which scroll beautifully! 3 of them scroll horizontally AND vertically equally as good, and the other 4 only scroll horizontally so it gave me a new respect for panoramas
Screenshots
I'd have to post an animated .gif and quite frankly I don't think I have a program that does that, sorry :P
Script
Code:
#===============================================================================
# ** Map : Scroll Panorama
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Map.ScrollPanorama', 'Kain Nobel ©', 3.5, '2009.06.17')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : Begin
#-------------------------------------------------------------------------------
if SDK.enabled?('Map.ScrollPanorama')
#===============================================================================
# ** Game_Map
#===============================================================================
class Game_Map
#-----------------------------------------------------------------------------
# * Value for determining if the panorama's coordinates are to auto-reset
#-----------------------------------------------------------------------------
ScrollPanoramaAutoReset = nil
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_accessor :panorama_sx
attr_accessor :panorama_sy
#-----------------------------------------------------------------------------
# * Setup
#-----------------------------------------------------------------------------
def setup(map_id)
reset_panorama if scroll_panorama_reset?(map_id)
scrollpanorama_gmmap_setup(map_id)
end
#-----------------------------------------------------------------------------
# * Scroll Panorama Reset Switch?
#-----------------------------------------------------------------------------
def scroll_panorama_reset?(map_id)
switch, bool = ScrollPanoramaAutoReset, false
if (switch.is_a?(TrueClass) || switch.is_a?(FalseClass))
bool = switch
elsif switch.is_a?(Numeric)
bool = $game_switches[switch]
elsif switch.is_a?(Array)
bool = switch.include?(map_id)
end
bool
end
#-----------------------------------------------------------------------------
# * Reset Panorama
#-----------------------------------------------------------------------------
def reset_panorama
@panorama_sx = nil
@panorama_sy = nil
end
end
#===============================================================================
# ** Spriteset_Map
#===============================================================================
class Spriteset_Map
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :scrollpanorama_sprsetmap_initialize, :initialize
alias_method :scrollpanorama_sprsetmap_updatepanorama, :update_panorama_plane
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
@panorama_ox = @panorama_fx = 0
@panorama_oy = @panorama_fy = 0
scrollpanorama_sprsetmap_initialize
end
#-----------------------------------------------------------------------------
# * Update Panorama
#-----------------------------------------------------------------------------
def update_panorama_plane
scrollpanorama_sprsetmap_updatepanorama
if $game_map.panorama_sx.nil?
@panorama_ox = $game_map.display_x / 8
@panorama_fx = 0
$game_map.panorama_sx = 0
end
if $game_map.panorama_sy.nil?
@panorama_oy = $game_map.display_y / 8
@panorama_fy = 0
$game_map.panorama_sy = 0
end
w = @panorama.bitmap.width rescue 0
h = @panorama.bitmap.height rescue 0
@panorama_fx += $game_map.panorama_sx
@panorama_fy += $game_map.panorama_sy
while @panorama_fx >= 8
@panorama_fx -= 8
@panorama_ox += 1
end
while @panorama_fx <= -8
@panorama_fx += 8
@panorama_ox -= 1
end
while @panorama_fy >= 8
@panorama_fy -= 8
@panorama_oy += 1
end
while @panorama_fy <= -8
@panorama_fy += 8
@panorama_oy -= 1
end
@panorama_ox += (@panorama_ox > w ? -w : @panorama_ox < -w ? w : 0)
@panorama_oy += (@panorama_oy > h ? -h : @panorama_oy < -h ? h : 0)
@panorama.ox = @panorama_ox
@panorama.oy = @panorama_oy
end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test : End
#-------------------------------------------------------------------------------
end
Instructions
Place below SDK and above Main. Requires the Spriteset_Map#update method split, but if you're crafty you'll know what lines to replace in the default code to get this effect so you don't need SDK
FAQ
What this constant does is, depending on what you set, it'll auto-reset the position of the panorama when a new map is setup... A method looks up if this constant is set to true, false, a number or an array...
If it is a Number
Represents a Switch's ID number. If this switch is on, then anytime you visit a new map its panorama is automatically reset.
If it is an Array
An array of Integers representing different Map ID's. If this array contains said map ID of the new map being setup, then its panorama is automatically reset.
If it is True
Means that the panorama will automatically be reset on any new map you visit.
If it is False (or nil, or anything else)
Doesn't auto-reset at all. You'll have to use your trusty Call Script box to reset your panoramas manually on certain maps.
Conclusion
I did that because different developers like to do things their own way, one person might want to use a switch, while another might want to do it manually, etc...
If it is a Number
Represents a Switch's ID number. If this switch is on, then anytime you visit a new map its panorama is automatically reset.
If it is an Array
An array of Integers representing different Map ID's. If this array contains said map ID of the new map being setup, then its panorama is automatically reset.
If it is True
Means that the panorama will automatically be reset on any new map you visit.
If it is False (or nil, or anything else)
Doesn't auto-reset at all. You'll have to use your trusty Call Script box to reset your panoramas manually on certain maps.
Conclusion
I did that because different developers like to do things their own way, one person might want to use a switch, while another might want to do it manually, etc...
Scroll X and Scroll Y for the panorama are represented and set through the following call...
$game_map.panorama_sx = n
$game_map.panorama_sy = n
When panorama_sx is set to a positive number, it is scrolled right and negative will make it scroll left, alternative if it is set to 0 then it just doesn't move.
$game_map.panorama_sx = n
$game_map.panorama_sy = n
When panorama_sx is set to a positive number, it is scrolled right and negative will make it scroll left, alternative if it is set to 0 then it just doesn't move.
Very easy! Theres two ways, in order to reset both panorama's ox and oy, you'd do...
$game_map.reset_panorama
...or, to do it independantly...
$game_map.panorama_sx = nil
$game_map.panorama_sy = nil
Please note, setting these values to 0 will not reset the panorama, it'll just stop the scroll speed. So nil is the magic value that resets the actual panorama's position, x and/or y.
$game_map.reset_panorama
...or, to do it independantly...
$game_map.panorama_sx = nil
$game_map.panorama_sy = nil
Please note, setting these values to 0 will not reset the panorama, it'll just stop the scroll speed. So nil is the magic value that resets the actual panorama's position, x and/or y.
By 'independantly', I mean panoramas which can be scrolled vertically AND horizontally and look equally as good. Default standards, I'll point out these ones work nicely...
- 001-Sky01
- 002-Sky02
- 003-StarlitSky01
By 'horizontal', I mean strictly left to right and visa versa, not counting panoramas which scroll 'vertically' as well.
- 004-CloudySky01
- 005-Sunset01
- 006-Mountains01
- 007-Ocean01
Compatibility
SDK Required, Spriteset_Map#update_panorama_plane method. Alternatively, you can go into the default Spriteset_Map class and place the entire method directly underneath line 122. Thats all the help I can give you for non-SDK so please don't ask me :P
Credits and Thanks
Thanks Enterbrain for the beautiful panoramas that scroll nicely from end to end
Thanks Capcom for making TMNT IV which shows an example of scrolling panorama
Terms and Conditions
Free to use in commercial and non-commercial work, please credit me if you do so :thumb: