Le Deal du moment :
Réassort du coffret Pokémon 151 ...
Voir le deal

Aller en bas
doudou08
doudou08
Membre

Nombre de messages : 23
Distinction : aucune
Date d'inscription : 28/12/2012

Mapping en parallax et droit de passage... Empty Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 19:49
Bonjour à tous et à toutes et à tout le monde!...Bon j'arrête.

Je viens de reprendre rpg maker vx Ace et je me suis dis....et si je mapper en parallax?
Après quelques longues minutes de mapping via Gimp je fini ma petite map,tout content de moi!(aider via un tuto)
Le problème c'est que en testant la map je me suis rendu compte que mon héros était ... clouer sur place!
J'ai fais des recherches sur le fofo et j'ai trouver un seul sujet à ce propos mais je ne l'ai malheureusement pas très bien compris..
J'ai essayer le système de croix/rond/étoile et sa a presque marcher...presque! Le seul problème que j'ai eu est que l'étoile est considérer
dans mon cas comme une croix et donc,non-passable.

J'espère qu'une âme sereine et gentille sera capable de m'aider !
Bonnes vacances à vous!
DantonSlip
DantonSlip
Membre

Nombre de messages : 409
Age : 32
Distinction : 1er membre de la communauté Curse
Date d'inscription : 31/05/2013
http://www.dantonslip.com

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 21:12
Salut !


Alors pour ton soucis ouvre ton logiciel, appuie sur F9
-> Va dans l'onglet "Tileset"
-> Clique sur "définir maximum..."
-> Met le titre que tu veux
-> Place toi sur "A2 Terrains"
-> Sélectionne le tileset A5
-> Clique sur "Appliquer"
-> Ferme le menu.

-> Maintenant utilise ce tileset pour tes maps.


Pourquoi ça marche ? Parce que tu n'as pas placé d'interdictions au joueur d'aller sur les cases "noires" (bleues et bleu foncées sur ton tileset).

Un conseil : Si tu veux que ton personnage ne puisse pas toucher des éléments de ton parallaxe, retourne sur ton tileset dans le menu et met une croix sur l'une des cases bleues et bleu foncées. Clique sur "Appliquer" puis "Ok". Et tu utilise cette case en particulier sur toutes celles que tu souhaites bloquer. Wink Attention à ne pas oublier laquelle c'est :p
doudou08
doudou08
Membre

Nombre de messages : 23
Distinction : aucune
Date d'inscription : 28/12/2012

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 21:43
Ok cela fonctionne,mille merci! Mais il me reste juste ce petit problème aussi...J'aimerai bien que mon héros puisse passer en dessous de certain décors comme par exemple,un arbre ou bien un pont aussi.
DantonSlip
DantonSlip
Membre

Nombre de messages : 409
Age : 32
Distinction : 1er membre de la communauté Curse
Date d'inscription : 31/05/2013
http://www.dantonslip.com

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 22:14
doudou08
doudou08
Membre

Nombre de messages : 23
Distinction : aucune
Date d'inscription : 28/12/2012

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 22:25
Ha merci beaucoup!Je fais mon chiant ,ce script vient de vx,il est compatible à Ace?
DantonSlip
DantonSlip
Membre

Nombre de messages : 409
Age : 32
Distinction : 1er membre de la communauté Curse
Date d'inscription : 31/05/2013
http://www.dantonslip.com

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 22:29
Honnêtement, je n'en sais rien, je ne l'ai pas encore testé... Au pire, passe ton eu sous VX. :/
crackerwood
crackerwood
Membre

Nombre de messages : 364
Age : 39
Localisation : Derrière son pc y parait
Distinction : aucune
Date d'inscription : 03/08/2008

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Ven 30 Aoû 2013 - 22:44
Salut. J'ai regardé un peu les liens et j'ai trouvé ce script qui serait adapté pour ace :

Code:
#===============================================================
# ● [VX ACE] ◦ Multiple Fogs ◦ □
# * Use unlimited layers of fog *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 13/05/2008
# ◦ Version: 1.0
# ◦ ported to VX Ace by Necromus 17/03/2012
#--------------------------------------------------------------

#==================================================================
# ** HOW TO USE **
# * use event command 'Script...' for the any script line below~
#-----------------------------------------------------------------
#
#---------------------------------------------------------------
# ** SETUP FOG PROPERTIES & SHOW FOG **
# * You have to setup fog properties, before show fog~
#-------------------------------------------------------------
# * There are 3 ways to setup fog properties:
# >> Setup Fog [Custom]:
# $fog.name = 'image_name' # Image file name, must be in fog image path (setup path below).
# $fog.hue = (integer) # Fog's hue. 0 - 360, 0 for no hue.
# $fog.tone = [red, green, blue, gray] # Fog's tone color.
# $fog.opacity = (integer) # Fog's opacity. 0 - 255, you will not see fog in 0.
# $fog.blend = (0, 1, or 2) # Fog's blend type. 0 for Normal, 1 for Add, 2 for Subtract.
# $fog.zoom = (integer) # Fog's size (in %). 100 for normal size.
# $fog.sx = (+ or - integer) # Fog's horizontal move speed.
# $fog.sy = (+ or - integer) # Fog's vertical move speed.
#
# >> Setup Fog [From Preset]:
# (You can setup fog presets, in part FOG PRESET SETUP below)
# $fog.load_preset(preset_id)
#
# >> Setup Fog [From Fog that showing]:
# $fog.load_fog(fog_id)
#
#--------------------------------------------------------------
# ** SHOW FOG **
#-------------------------------------------------------------
# After setup the fog, show fog by call script:
# $fog.show(fog_id)
#
# In case you want to show new fog on same ox, oy, tone as old fog. Call Script:
# $fog.show(old_fog_id, false)
#
# * fog_id: the ID number you want to put this fog in.
# (It can be any positive number or zero)
#
# After you show fog, the fog properties you've set will replace with default setting.
# (You can setup default setting, in part FOG DEFAULT SETTING below)
#
#--------------------------------------------------------------
# ** DELETE FOG **
#-------------------------------------------------------------
# You can delete 1 or more fog(s) at a time by call script:
# $fog.delete(fog_id, fog_id, fog_id, ...)
#
#---------------------------------------------------------------
# ** OLD FOG CONTROL EVENT COMMANDS **
#-------------------------------------------------------------
# Change Fog Tone:
# $game_map.fogtone(fog_id, [red, green, blue, gray], duration)
# e.g. $game_map.fogtone(1, [100,200,-100,0], 10)

# Change Fog Opacity:
# $game_map.fogopac(fog_id, new_opacity, duration)
# e.g. $game_map.fogopac(2, 200, 10)
#
#---------------------------------------------------------------
# ** ADDITIONAL SETTINGS **
#-------------------------------------------------------------
# Change Fog Image's Path:
# $game_map.fog_path = 'image_path'
# e.g. $game_map.fog_path = 'Graphics/Pictures/'

# Turn ON/OFF [Automatically clear all fogs when transfer player]:
# $game_map.fog_reset = (true / false)
#
#===============================================================

#==================================================================
# START ** MULTIPLE FOG SETUP **
#==================================================================
class Game_Map
  alias wora_mulfog_gammap_ini initialize
  def initialize
   wora_mulfog_gammap_ini
   
   #==================================================================
   # ** MULTIPLE FOG SETUP ** SETTINGS
   #--------------------------------------------------------------
   @fog_path = 'Graphics/Pictures/'
   # Fog image's path
   @fog_reset = true # (true or false)
   # Automatically clear all multiple fogs when transfer player
   #==================================================================
   
   @mulfog_name = []
   @mulfog_hue = []
   @mulfog_opacity = []
   @mulfog_blend_type = []
   @mulfog_zoom = []
   @mulfog_sx = []
   @mulfog_sy = []
   @mulfog_ox = []
   @mulfog_oy = []
   @mulfog_tone = []
   @mulfog_tone_target = []
   @mulfog_tone_duration = []
   @mulfog_opacity_duration = []
   @mulfog_opacity_target = []
  end
end
class Wora_Multiple_Fog
  def set_default
   #==================================================================
   # ** MULTIPLE FOG SETUP ** FOG DEFAULT SETTING
   #--------------------------------------------------------------
   @name = ''
   @hue = 0
   @opacity = 64
   @blend = 0
   @zoom = 200
   @sx = 0
   @sy = 0
   @tone = [0,0,0,0]
   #==================================================================
  end

  def load_preset(preset_id)
   case preset_id
   #==================================================================
   # ** MULTIPLE FOG SETUP ** FOG PRESET SETUP
   #--------------------------------------------------------------
   when 1 # Preset ID 1
     @name = 'Fog'
     @hue = 0
     @tone = [100,-255,20,0]
     @opacity = 60
     @blend = 0
     @zoom = 200
     @sx = 10
     @sy = 0
   when 2 # Preset ID 2
     @name = 'Cloud2'
     @hue = 0
     @tone = [0,0,0,0]
     @opacity = 60
     @blend = 0
     @zoom = 200
     @sx = 10
     @sy = 0
  when 3 # Preset ID 3
     @name = 'Cloud3'
     @hue = 0
     @tone = [0,0,0,-100]
     @opacity = 150
     @blend = 0
     @zoom = 140
     @sx = 2
     @sy = 1
   #==================================================================
   end
  end
#==================================================================
# END ** MULTIPLE FOG SETUP **
# * Don't change anything below unless you know what you're doing.
#==================================================================

  attr_accessor :name, :hue, :opacity, :blend, :zoom, :sx, :sy, :tone
  def initialize
   set_default
  end

  def load_fog(id)
   @name = $game_map.mulfog_name[id].sub($game_map.fog_path, '')
   @hue = $game_map.mulfog_hue[id]
   @opacity = $game_map.mulfog_opacity[id]
   @blend = $game_map.mulfog_blend_type[id]
   @zoom = $game_map.mulfog_zoom[id]
   @sx = $game_map.mulfog_sx[id]
   @sy = $game_map.mulfog_sy[id]
   tn = $game_map.mulfog_tone[id]
   @tone = [tn.red, tn.blue, tn.green, tn.gray]
  end

  def show(id, reset_all = true)
   $game_map.mulfog_name[id] = $game_map.fog_path + @name
   $game_map.mulfog_hue[id] = @hue
   $game_map.mulfog_opacity[id] = @opacity
   $game_map.mulfog_blend_type[id] = @blend
   $game_map.mulfog_zoom[id] = @zoom
   $game_map.mulfog_sx[id] = @sx
   $game_map.mulfog_sy[id] = @sy
   $game_map.mulfog_tone[id] = Tone.new(@tone[0], @tone[1], @tone[2], @tone[3])
   if $game_map.mulfog_ox[id].nil? or reset_all
     $game_map.mulfog_ox[id] = 0
     $game_map.mulfog_oy[id] = 0
     $game_map.mulfog_tone_target[id] = Tone.new(0, 0, 0, 0)
     $game_map.mulfog_tone_duration[id] = 0
     $game_map.mulfog_opacity_duration[id] = 0
     $game_map.mulfog_opacity_target[id] = 0
   end
   set_default
  end

  def delete(*args)
   args.each do |id|
     $game_map.mulfog_name[id] = ''
   end
  end
end

class Game_Interpreter
  alias wora_mulfog_interpret_com201 command_201
  #--------------------------------------------------------------------------
  # * Transfer Player
  #--------------------------------------------------------------------------
  def command_201
   if $game_map.fog_reset
     if @params[0] == 0; id_map = @params[1]
     else; id_map = $game_variables[@params[1]]
     end
     $game_map.clear_mulfog if id_map != @map_id
   end
   wora_mulfog_interpret_com201
  end
end

class Game_Map
  attr_accessor :mulfog_name, :mulfog_hue, :mulfog_opacity, :mulfog_blend_type,
  :mulfog_zoom, :mulfog_sx, :mulfog_sy, :mulfog_ox, :mulfog_oy, :mulfog_tone,
  :mulfog_tone_target, :mulfog_tone_duration, :mulfog_opacity_duration,
  :mulfog_opacity_target, :fog_reset, :fog_path
  alias wora_mulfog_gammap_upd update
  def update(main)   
   wora_mulfog_gammap_upd(main)
   @mulfog_name.each_index do |i|
     next if @mulfog_name[i].nil? or @mulfog_name[i] == ''
     # Manage fog scrolling
     @mulfog_ox[i] -= @mulfog_sx[i] / 8.0
     @mulfog_oy[i] -= @mulfog_sy[i] / 8.0
     # Manage change in fog color tone
     if @mulfog_tone_duration[i] >= 1
      d = @mulfog_tone_duration[i]
      target = @mulfog_tone_target[i]
      @mulfog_tone[i].red = (@mulfog_tone[i].red * (d - 1) + target.red) / d
      @mulfog_tone[i].green = (@mulfog_tone[i].green * (d - 1) + target.green) / d
      @mulfog_tone[i].blue = (@mulfog_tone[i].blue * (d - 1) + target.blue) / d
      @mulfog_tone[i].gray = (@mulfog_tone[i].gray * (d - 1) + target.gray) / d
      @mulfog_tone_duration[i] -= 1
     end
     # Manage change in fog opacity level
     if @mulfog_opacity_duration[i] >= 1
      d = @mulfog_opacity_duration[i]
      @mulfog_opacity[i] = (@mulfog_opacity[i] * (d - 1) + @mulfog_opacity_target[i]) / d
      @mulfog_opacity_duration[i] -= 1
     end
   end
  end
  #--------------------------------------------------------------------------
  # * Start Changing Fog Color Tone
  #--------------------------------------------------------------------------
  def fogtone(i, tone, duration)
   duration = duration * 2
   tone = Tone.new(tone[0], tone[1], tone[2], tone[3])
   @mulfog_tone_target[i] = tone.clone
   @mulfog_tone_duration[i] = duration
   if @mulfog_tone_duration[i] == 0
     @mulfog_tone[i] = @mulfog_tone_target[i].clone
   end
  end
  #--------------------------------------------------------------------------
  # * Start Changing Fog Opacity Level
  #--------------------------------------------------------------------------
  def fogopac(i, opacity, duration)
   duration = duration * 2
   @mulfog_opacity_target[i] = opacity * 1.0
   @mulfog_opacity_duration[i] = duration
   if @mulfog_opacity_duration[i] == 0
     @mulfog_opacity[i] = @mulfog_opacity_target[i]
   end
  end

  def clear_mulfog
   @mulfog_name.each_index {|i| @mulfog_name[i] = '' }
  end
end
$worale = {} if !$worale
$worale['MutipleFog'] = true
$fog = Wora_Multiple_Fog.new

class Spriteset_Map
  alias wora_mulfog_sprmap_crepal create_parallax
  alias wora_mulfog_sprmap_updpal update_parallax
  alias wora_mulfog_sprmap_dispal dispose_parallax

  def create_parallax
   @mulfog = []
   @mulfog_name = []
   @mulfog_hue = []
   wora_mulfog_sprmap_crepal
  end

  def update_parallax
#~    wora_mulfog_sprmap_updpal 
   $game_map.mulfog_name.each_index do |i|
     next if $game_map.mulfog_name[i].nil?
     # If fog is different than current fog
     if @mulfog_name[i] != $game_map.mulfog_name[i] or @mulfog_hue[i] != $game_map.mulfog_hue[i]
      @mulfog_name[i] = $game_map.mulfog_name[i]
      @mulfog_hue[i] = $game_map.mulfog_hue[i]
      if @mulfog[i].nil?
        @mulfog[i] = Plane.new(@viewport3)
        @mulfog[i].z = 3000
      end
      if @mulfog[i].bitmap != nil
        @mulfog[i].bitmap.dispose
        @mulfog[i].bitmap = nil
      end
      if @mulfog_name[i] != ''
        @mulfog[i].bitmap = Cache.load_bitmap('', @mulfog_name[i], @mulfog_hue[i])
      end
      Graphics.frame_reset
     end
     next if @mulfog[i].bitmap.nil?
     # Update fog plane
     @mulfog[i].zoom_x = ($game_map.mulfog_zoom[i] / 100.0) if @mulfog[i].zoom_x != ($game_map.mulfog_zoom[i] / 100.0)
     @mulfog[i].zoom_y = ($game_map.mulfog_zoom[i] / 100.0) if @mulfog[i].zoom_y != ($game_map.mulfog_zoom[i] / 100.0)
     @mulfog[i].opacity = $game_map.mulfog_opacity[i] if @mulfog[i].opacity != $game_map.mulfog_opacity[i]
     @mulfog[i].blend_type = $game_map.mulfog_blend_type[i] if @mulfog[i].blend_type != $game_map.mulfog_blend_type[i]
     @mulfog[i].ox = $game_map.mulfog_ox[i] + $game_map.display_x  * 32 if @mulfog[i].ox != $game_map.mulfog_ox[i] + $game_map.display_x  * 32 
     @mulfog[i].oy = $game_map.mulfog_oy[i] + $game_map.display_y  * 32 if @mulfog[i].oy != $game_map.mulfog_oy[i] + $game_map.display_y  * 32
     @mulfog[i].tone = $game_map.mulfog_tone[i] if @mulfog[i].tone != $game_map.mulfog_tone[i]
   end
  end

  def dispose_parallax
   @mulfog.each_index do |i|
     next if @mulfog[i].nil?
     @mulfog[i].bitmap.dispose if !@mulfog[i].bitmap.nil?
     @mulfog[i].dispose
   end
   wora_mulfog_sprmap_dispal
  end
end
#==================================================================
# [END] VX Multiple Fog by Woratana [woratana@hotmail.com]
#==================================================================
Je ne l'ai pas testé donc je peux pas te dire si ça fonctionne. Bonne chance.
Ezekiel Koening
Ezekiel Koening
Membre

Nombre de messages : 413
Age : 25
Localisation : Nantes
Distinction : aucune
Date d'inscription : 17/12/2011

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Sam 31 Aoû 2013 - 9:59
Pour Vx Ace y'a celui-ci, c'est celui que j'utilise :

Code:

#==============================================================================
#
# ¥ Yami Engine Ace - Overlay Mapping
# -- Last Updated: 2012.04.16
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-OverlayMapping"] = true

#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.16 - Reworked with Encrypted Game.
# 2012.04.13 - Ported into Yami Engine.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script based on Hanzo Kimura's idea. This will automatically load map's
# overlay by map ID, and a map can have more than one image per layer, so you
# don't have to create two or more map just for day/night or when an event occur.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Create a folder in Graphics and name it Overlay.
# Put all of your overlay into Graphics/Overlay.
# Your overlay file will have the name: "Filename Prefix" + Map-ID + "-" + Number
# which "Filename Prefix" is the one you will config below
# Map-ID is your map's ID
# Number is 1, 2, 3, ... using for Overlay Variables.
#
# Example: Graphics/Overlay/ground2-1.png
# Which means this will be ground layer, for map 2, variable = 1
#
# Light/Shadow must be .jpg
# Parallax/Ground must be .png
#
#==============================================================================

module YSA
  module OVERLAY
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Switches -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These are switches which are enable overlay layers. Turn them on to show
    # them in your maps.
    #--------------------------------------------------------------------------
    # Default: ON
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT_SWITCH = 1        # Turn on/off light layer
    SHADOW_SWITCH = 2      # Turn on/off shadow layer
    PARALLAX_SWITCH = 3    # Turn on/off parallax layer
    GROUND_SWITCH = 4      # Turn on/off ground layer

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Variables -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # A map can have more than one image per layer, that means you can have a
    # different light/shadow for day and night, or have a different ground when
    # an event occured.
    #--------------------------------------------------------------------------
    # Default: 1
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT_VARIABLE = 2      # Switch to another light
    SHADOW_VARIABLE = 2    # Switch to another shadow
    PARALLAX_VARIABLE = 1  # Switch to another parallax
    GROUND_VARIABLE = 1    # Switch to another ground
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Filename Prefix -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This will make this script automatic, it will check if there are layers in
    # overlay folder
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT = "light"        # Light layer's filename prefix
    SHADOW = "shadow"      # Shadow layer's filename prefix
    PARALLAX = "par"        # Parallax layer's filename prefix
    GROUND = "ground"      # Ground layer's filename prefix
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Opacity -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This will make this script automatic, it will check if there are layers in
    # overlay folder
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    GROUND_OPACITY = 255
    PARALLAX_OPACITY = 255
    LIGHT_OPACITY = 128
    SHADOW_OPACITY = 96
   
  end #OVERLAY
end # YSA

#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ¡ Cache
#==============================================================================

module Cache
 
  #--------------------------------------------------------------------------
  # new method: overlay
  #--------------------------------------------------------------------------
  def self.overlay(filename)
    begin
      self.load_bitmap("Graphics/Overlay/", filename)
    rescue
      self.empty_bitmap
    end
  end
 
end # Cache

#==============================================================================
# ¡ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: setup_new_game
  #--------------------------------------------------------------------------
  class <<self; alias ovm_setup_new_game setup_new_game; end
  def self.setup_new_game
    ovm_setup_new_game
    setup_overlay_mapping
  end
 
  #--------------------------------------------------------------------------
  # new method: setup_overlay_mapping
  #--------------------------------------------------------------------------
  def self.setup_overlay_mapping
    # Control switches
    $game_switches[YSA::OVERLAY::LIGHT_SWITCH] = true
    $game_switches[YSA::OVERLAY::SHADOW_SWITCH] = true
    $game_switches[YSA::OVERLAY::GROUND_SWITCH] = true
    $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] = true
   
    # Control variables
    $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::GROUND_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] = 1
  end
 
end # DataManager

#==============================================================================
# ¡ Spriteset_Map
#==============================================================================

class Spriteset_Map
 
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias overlay_initialize initialize
  def initialize
    overlay_initialize
    create_overlay_map
    update
  end
 
  #--------------------------------------------------------------------------
  # new method: create_overlay_map
  #--------------------------------------------------------------------------
  def create_overlay_map
    @current_light = 0
    @current_shadow = 0
    @current_par = 0
    @current_ground = 0
    # Ground Layer
    @ground = Sprite.new(@viewport1)
    @ground.z = 1
    @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
    # Light Layer
    @light = Sprite.new(@viewport1)
    @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
    @light.blend_type = 1
    @light.z = 299
    # Shadow Layer
    @shadow = Sprite.new(@viewport1)
    @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
    @shadow.blend_type = 2
    @shadow.z = 298
    # Parallax Layer
    @par = Sprite.new(@viewport1)
    @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
    @par.z = 297
  end
 
  #--------------------------------------------------------------------------
  # alias method: dispose_parallax
  #--------------------------------------------------------------------------
  alias overlay_dispose_parallax dispose_parallax
  def dispose_parallax
    overlay_dispose_parallax
    dispose_overlay_map
  end
 
  #--------------------------------------------------------------------------
  # new method: dispose_overlay_map
  #--------------------------------------------------------------------------
  def dispose_overlay_map
    @ground.dispose
    @light.dispose
    @shadow.dispose
    @par.dispose
  end
 
  #--------------------------------------------------------------------------
  # alias method: update_parallax
  #--------------------------------------------------------------------------
  alias overlay_update_parallax update_parallax
  def update_parallax
    overlay_update_parallax
    update_overlay
  end
 
  #--------------------------------------------------------------------------
  # new method: update_overlay
  #--------------------------------------------------------------------------
  def update_overlay
    update_om_ground
    update_om_par
    update_om_light
    update_om_shadow
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_ground
  #--------------------------------------------------------------------------
  def update_om_ground
    return unless @ground
    @ground.visible = $game_switches[YSA::OVERLAY::GROUND_SWITCH] if @ground.visible != $game_switches[YSA::OVERLAY::GROUND_SWITCH]
    @ground.ox = $game_map.display_x * 32 if @ground.ox != $game_map.display_x * 32
    @ground.oy = $game_map.display_y * 32 if @ground.oy != $game_map.display_y * 32
    if @current_ground != $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
      filename = YSA::OVERLAY::GROUND
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s
      @ground.bitmap = Cache.overlay(filename)
      @current_ground = $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_par
  #--------------------------------------------------------------------------
  def update_om_par
    return unless @par
    @par.visible = $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] if @par.visible != $game_switches[YSA::OVERLAY::PARALLAX_SWITCH]
    @par.ox = $game_map.display_x * 32 if @par.ox != $game_map.display_x * 32
    @par.oy = $game_map.display_y * 32 if @par.oy != $game_map.display_y * 32
    if @current_par != $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
      filename = YSA::OVERLAY::PARALLAX
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s
      @par.bitmap = Cache.overlay(filename)
      @current_par = $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_light
  #--------------------------------------------------------------------------
  def update_om_light
    return unless @light
    @light.visible = $game_switches[YSA::OVERLAY::LIGHT_SWITCH] if @light.visible != $game_switches[YSA::OVERLAY::LIGHT_SWITCH]
    @light.ox = $game_map.display_x * 32 if @light.ox != $game_map.display_x * 32
    @light.oy = $game_map.display_y * 32 if @light.oy != $game_map.display_y * 32
    if @current_light != $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
      filename = YSA::OVERLAY::LIGHT
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s
      @light.bitmap = Cache.overlay(filename)
      @current_light = $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_shadow
  #--------------------------------------------------------------------------
  def update_om_shadow
    return unless @shadow
    @shadow.visible = $game_switches[YSA::OVERLAY::SHADOW_SWITCH] if @shadow.visible != $game_switches[YSA::OVERLAY::SHADOW_SWITCH]
    @shadow.ox = $game_map.display_x * 32 if @shadow.ox != $game_map.display_x * 32
    @shadow.oy = $game_map.display_y * 32 if @shadow.oy != $game_map.display_y * 32
    if @current_shadow != $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
      filename = YSA::OVERLAY::SHADOW
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s
      @shadow.bitmap = Cache.overlay(filename)
      @current_shadow = $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
    end
  end
 
end # Spriteset_Map

#==============================================================================
# ¡ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias method: post_transfer
  #--------------------------------------------------------------------------
  alias overlay_post_transfer post_transfer
  def post_transfer
    @spriteset.dispose_overlay_map
    @spriteset.create_overlay_map
    @spriteset.update
    overlay_post_transfer
  end

end # Scene_Map

#==============================================================================
#
# ¥ End of File
#
#==============================================================================
Contenu sponsorisé

Mapping en parallax et droit de passage... Empty Re: Mapping en parallax et droit de passage...

Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum