Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Ultimate Parallax Control V1.0
- #
- # By: GDS
- # Translate: Pigu
- #
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2012.21.05 - Script istart and finish
- #
- #==============================================================================
- # ▼ Introduccion
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # Con este script tienes todas las funciones de parallaxes en uno
- # no necesita "script calls", <notetags> ni tampoco switches o variables
- # aunque estos ultimos si se pueden activar
- #
- #==============================================================================
- # CONFIGURACIONES
- #==============================================================================
- module GDS_Parallax
- module Parallax
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #All parallaxes are fixed by defaut now,
- #if want the default movement of the parallaxex just put the map id here
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- FIXED_Parallax =[ #<=|Id of the map that will not be fixed
- ] #
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Cielo,
- # Esta capa esta arriba de todas las demas, no tiene movimiento
- #
- # Para activarla necesitamos una imagen en \Graphics\Parallaxes
- # con el nombre "x"_layer2,
- # X es el numero de ID que lleva el mapa
- #
- # Ejemplo:
- # "\Graphics\Parallaxes\1_layer2"
- # Esto activa la imagen "layer2"
- #
- # Parallax2 <= Poner el ID del mapa q va a usar cielo
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Parallax2 = [0, # Mapas con el Cielo activado
- ]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Luces
- # Esta capa esta justo debajo de la capa cielo, puede moverse o estar quieta
- #
- #
- # Para activarla necesitamos una imagen en \Graphics\Parallaxes
- # con el nombre "X"_light
- # X es el numero de ID que lleva el mapa
- #
- # Ejemplo:
- # "\Graphics\Parallaxes\1_light"
- #
- #
- # Light <= Poner el ID del mapa q va a usar luces
- #
- #
- #:Flicker_Light
- #
- # 0 => No se mueve
- # 1 o mas => la luz se mueve, cualquier valor mayor a 1 queda raro el efecto
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Light = [0, #< Mapas con luces activadas
- ]
- Flicker_Light = 1 #< Movimiento de luces
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Sombras
- # Esta capa esta debajo del Cielo y las Luces, esta arriba del Suelo
- # puede moverse o estar quieta
- #
- # Para activarla necesitamos una imagen en \Graphics\Parallaxes
- # con el nombre "X"_shadow
- # X es el numero de ID que lleva el mapa
- #
- # Ejemplo:
- # "\Graphics\Parallaxes\1_shadow"
- #
- #
- # Shadow <= Poner el ID del mapa que va a usar las sombras
- #
- #
- #:Flicker_Shadow
- #
- # 0 => No se mueve
- # 1 o mas => la sombra se mueve, cualquier valor mayor a 1 queda raro el efecto
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Shadow = [0, #<=|Mapas con sombras activadas
- ]
- Flicker_Shadow = 0 #<= Movimiento de sombras
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Suelo
- # Esta capa esta debajo de los personajes y eventos y por encima de los Tiles
- #
- # Para activarla necesitamos una imagen en \Graphics\Parallaxes\
- # Con el nombre "X"_Ground
- # X es el numero de ID que lleva el mapa
- #
- # Ejemplo:
- # "\Graphics\Parallaxes\1_ground"
- #
- #
- # Ground <= Poner el ID del mapa que va a usar las sombras
- #
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Ground = [1, 3 #<=|Id of the map that will use the ground layer
- ]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Switches/Interruptores y Variables
- #
- # Interruptores
- #
- # Activa o desactiva las capas de parallax
- # si no lo vas a usar deja "nil"
- #
- # Variables
- # cambia la imagen de que va a usar
- #
- # Ejemplo:
- # La luz del mapa cuatro se llama: "4_light"
- #
- # pero si queres usar variables para ver que luz se activa:
- #
- # Valor de variable = "0 nombre" = "4_light"
- # Valor de variable = "1 nombre" = "4-1_light"
- # Valor de variable = "5 nombre" = "4-5_light
- #
- # Hay que agregar "-X" despues del ID del mapa
- # en el que "X" es el numero de variable
- #
- #
- #
- # Atencion
- #
- # Los switches/interruptores solo van a funcionar cuando este en on/off
- # Las variables necesitan cambiar de mapa primero
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- SWITCH_SKY = nil
- SWITCH_LIGHT = nil
- SWITCH_SHADOW = nil
- SWITCH_GROUND = nil
- VARIABLE_SKY = nil
- VARIABLE_LIGHT = nil
- VARIABLE_SHADOW = nil
- VARIABLE_GROUND = nil
- #==============================================================================
- # End of configuration
- #==============================================================================
- #==============================================================================
- # ** Spriteset_Map
- #------------------------------------------------------------------------------
- # This class brings together map screen sprites, tilemaps, etc. It's used
- # within the Scene_Map class.
- #==============================================================================
- end
- end
- class Spriteset_Map
- include GDS_Parallax::Parallax
- #=============================================================================
- # * alias method create_parallax
- #=============================================================================
- alias create_parallax_gds create_parallax
- def create_parallax
- create_parallax_gds
- create_parallaxes
- @do_it1 = true;@do_it2 = true;@do_it3 = true;@do_it4 = true
- end
- def create_parallaxes
- map = $game_map.map_id
- @maps = $game_map.map_id
- ;@check1 = true;@check2 = true;@check3 = true;@check4 = true
- @fixed_p = false;@create1 = false;@create2 = false;@create2 = false;@create3 = false;@create4 = false
- for i in FIXED_Parallax;@fixed_p = true if i == map;end
- for i in Parallax2;@create1 = true if i == map;end
- for i in Light;@create2 = true if i == map;end
- for i in Shadow;@create3 = true if i == map;end
- for i in Ground;@create4 = true if i == map;end
- @parallax1 = Plane.new(@viewport1) if @create1 == true
- @parallax1.z = 203 if @create1 == true;@check1 = false
- @parallax2 = Plane.new(@viewport1) if @create2 == true
- @parallax2.z = 202 if @create2 == true ;@check2 = false
- @parallax3 = Plane.new(@viewport1) if @create3 == true
- @parallax3.z = 201 if @create3 == true;@check3 = false
- @parallax4 = Plane.new(@viewport1) if @create4 == true
- @parallax4.z = 50 if @create4 == true ;@check4 = false
- on1= false
- on2= false
- on3= false
- on4= false
- end
- #=============================================================================
- # * new method create_and_dispose
- # * new method check_for_dispose
- #=============================================================================
- def create_and_dispose
- @parallax1.dispose if @on1 == true
- @parallax2.dispose if @on2 == true
- @parallax3.dispose if @on3 == true
- @parallax4.dispose if @on4 == true
- create_parallaxes
- p "done"
- end
- def check_for_dispose
- create_and_dispose if @maps != $game_map.map_id
- end
- #=============================================================================
- # * new method check_for_swicthes
- #=============================================================================
- #=============================================================================
- # * alias method dispose_parallax
- #=============================================================================
- alias dispose_parallax_gds dispose_parallax
- def dispose_parallax
- @parallax1.dispose if @on1 == true
- @parallax2.dispose if @on2 == true
- @parallax3.dispose if @on3 == true
- @parallax4.dispose if @on4 == true
- dispose_parallax_gds
- end
- #=============================================================================
- # * overwrite method update_parallax
- #=============================================================================
- def update_parallax
- check_for_dispose
- @parallax1.visible= $game_switches[SWITCH_SKY] if SWITCH_SKY != nil
- @parallax2.visible= $game_switches[SWITCH_LIGHT] if SWITCH_LIGHT != nil
- @parallax3.visible= $game_switches[SWITCH_SHADOW] if SWITCH_SHADOW != nil
- @parallax4.visible= $game_switches[SWITCH_GROUND] if SWITCH_GROUND != nil
- if @parallax_name != $game_map.parallax_name
- @parallax_name = $game_map.parallax_name
- @parallax.bitmap.dispose if @parallax.bitmap
- @parallax.bitmap = Cache.parallax(@parallax_name)
- Graphics.frame_reset
- end
- if @create1 == true and @check1 == false
- @parallax1.bitmap.dispose if @parallax1.bitmap
- sky = $game_map.map_id.to_s
- if VARIABLE_SKY != nil
- sky = $game_map.map_id.to_s+"-"+$game_variables[VARIABLE_SKY].to_s
- sky = $game_map.map_id.to_s if $game_variables[VARIABLE_SKY] == 0
- end
- @parallax1.bitmap = Cache.parallax(sky+"_layer2")
- Graphics.frame_reset
- @check1 = true;@on1 = true
- end
- if @create2 == true and @check2 == false
- @parallax2.bitmap.dispose if @parallax2.bitmap
- light = $game_map.map_id.to_s
- if VARIABLE_LIGHT != nil
- light = $game_map.map_id.to_s+"-"+$game_variables[VARIABLE_LIGHT].to_s
- light = $game_map.map_id.to_s if $game_variables[VARIABLE_LIGHT] == 0
- end
- @parallax2.bitmap = Cache.parallax(light+"_light")
- Graphics.frame_reset
- @check2 = true;@on2 = true
- end
- if @create3 == true and @check3 == false
- @parallax3.bitmap.dispose if @parallax3.bitmap
- shadow = $game_map.map_id.to_s
- if VARIABLE_SHADOW != nil
- shadow = $game_map.map_id.to_s+"-"+$game_variables[VARIABLE_SHADOW].to_s
- shadow = $game_map.map_id.to_s if $game_variables[VARIABLE_SHADOW] == 0
- end
- @parallax3.bitmap = Cache.parallax(shadow+"_shadow")
- Graphics.frame_reset
- @check3 = true;@on3 = true
- end
- if @create4 == true and @check4 == false
- @parallax4.bitmap.dispose if @parallax4.bitmap
- ground = $game_map.map_id.to_s
- if VARIABLE_GROUND != nil
- ground = $game_map.map_id.to_s+"-"+$game_variables[VARIABLE_GROUND].to_s
- ground = $game_map.map_id.to_s if $game_variables[VARIABLE_GROUND] == 0
- end
- @parallax4.bitmap = Cache.parallax(ground+"_ground")
- Graphics.frame_reset
- @check4 = true;@on4 = true
- end
- @parallax1.ox = $game_map.display_x * 32 if @create1 == true
- @parallax1.oy = $game_map.display_y * 32 if @create1 == true
- @parallax2.ox = $game_map.display_x * 32 + rand(Flicker_Light) if @create2 == true
- @parallax2.oy = $game_map.display_y * 32 + rand(Flicker_Light) if @create2 == true
- @parallax3.ox = $game_map.display_x * 32 + rand(Flicker_Shadow) if @create3 == true
- @parallax3.oy = $game_map.display_y * 32 + rand(Flicker_Shadow) if @create3 == true
- @parallax4.ox = $game_map.display_x * 32 if @create4 == true
- @parallax4.oy = $game_map.display_y * 32 if @create4 == true
- if @fixed_p == true
- @parallax.ox = $game_map.parallax_ox(@parallax.bitmap)
- @parallax.oy = $game_map.parallax_oy(@parallax.bitmap)
- else
- @parallax.ox = $game_map.display_x * 32
- @parallax.oy = $game_map.display_y * 32
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment