Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use FOG as Panorama
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


So here's the "FOG used as PANORAMA"-Option with a Switch to turn it ON and OFF.

If somebody wonders, what's that good for. Because you can you move fogs but you can't move panoramas. So I tried to put the layer of the fog into the background of the map, to use it's movement capabilities as a panorama-feature.

To change it to normal behaviour (in front of the Map) and vice versa (in the background as panorama) you can now use a Switch.

(Thanks to "RyoSakura" und "Mäde" for their hints)

Update: 04 / 24 / 2005

I optimized the Script, the Fog-Switch works now in every event, not only in Teleport,
so you can use in Autostart, if entering a map for example.

The Switchs-Behaviour has changed:

Switch[2]=OFF=Fog normal
Switch[2]=OFF=Fog in background

(so change that in your events, if you used the old script already)

So you mustn't set the Switch[2] at gamestart, to get normal fog's behaviour

And I got rid of the viewport4-definition in the script,
so the default Spriteset_Map-Script is just slightly modified.


Replace Spriteset_Map-Script with this:

Code:
#=================================================================
# Spriteset_Map
#----------------------------------------------------------------------------------------------------------------------------------
#
# Scene_Map
# weiterentwickelt von: Rabu, Ryo Sakura & Made
# advanced by: Rabu, Ryo Sakura & Made
# um den Fog als Panorama zu nutzen (to use Fog as Panorama)
# Switch [2] wird benutzt (is used), um das Fog-Verhalten umzuschalten (to change Fog-Bevahiour)
# Switch [2] = OFF (Fog normal) - Switch[2] = ON (Fog im Hintergrund / in background)
# Benutze die Zeilen 40 / 43 / 168 / 171 fur Switch-Anpassung
# Use lines 40 / 43 / 168 / 171 to set Switch for your Purposes
# Release 2: Relase-Date:24. April 2005
#===========================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def initialize
#
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# Fog-Panorama-Switch-Def - Start ----------------------------------------------------
@fog = Plane.new(@viewport1)
# Switch [2] eventuell anpassen - change Switch [2] if needed  
if $game_switches[2] == true    
@fog.z = -1000
# Switch [2] eventuell anpassen - change Switch [2] if needed  
elsif $game_switches[2] == false
@fog.z = 3000
end
# Fog-Panorama-Switch-Def - End ----------------------------------------------------
#
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
#
@weather = RPG::Weather.new(@viewport1)
#
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
#
@timer_sprite = Sprite_Timer.new
#
update
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def dispose
#
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
#
@panorama.dispose
#  
@fog.dispose
#
for sprite in @character_sprites
sprite.dispose
end
#
@weather.dispose
#
for sprite in @picture_sprites
sprite.dispose
end
#
@timer_sprite.dispose
#
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update
#
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
#
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
#
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
#
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
#
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
#
for sprite in @character_sprites
sprite.update
end
#
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
#
for sprite in @picture_sprites
sprite.update
end
#
@timer_sprite.update
#  
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
#
@viewport3.color = $game_screen.flash_color
#
# Fog-Panorama-Update -- Start ----------------------------------------------------
# Switch [2] eventuell anpassen - change Switch [2] if needed
if $game_switches[2] == true    
@fog.z = -1000
# Switch [2] eventuell anpassen - change Switch [2] if needed
elsif $game_switches[2] == false  
@fog.z = 3000
end
# Fog-Panorama-Update -- End ----------------------------------------------------
@viewport1.update
@viewport3.update
end
end

In this advanced Script-Section Switch [2] ($game_switches[2] ) will be used, to change the FOG's-Behaviour. You can choose any other Switch, if that Switch is already used in your game.
But you have to change it 4 times, 'cause the switch is defined 4 times in the scripts-section.

If the defined Switch is "OFF", the FOG's Option will be used as usual (over the map), if that Switch is "ON", the FOG will be used as panorama in the background of the map.

If you will use the fog as panorama, set the Switch to "ON" in a Teleport-Event for example. If you do a teleport to another map, where the normal fog-behaviour should be used, set the switch to "OFF" again.

But remember to import the fogs, which will be used as panorama with the fog-option into the FOG's-directory.
}




Users browsing this thread: