Multiple Fog




Pengenalan

Skrip buat memunculkan lebih dari satu fog


Fitur

  • Memunculkan lebih dari satu fog




Scripts

Code:

#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc.
#  It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def multifog(a,b,c)
    @fog2_name = ""
    @fog2 = Plane.new(a)
    @fog2.z = -400
    @fog2_ox = 0
    @fog2_oy = 0 
   
    @fog3_name = ""
    @fog3 = Plane.new(b)
    @fog3.z = -300 
    @fog3_ox = 0
    @fog3_oy = 0
   
    @fog4_name = ""
    @fog4 = Plane.new(c)
    @fog4.z = -200 
    @fog4_ox = 0
    @fog4_oy = 0
  end
  #--------------------------------------------------------------------------
  # * Fog Setup
  #--------------------------------------------------------------------------
  def system_fog_setup
    $game_system.fog2_name = ""
    $game_system.fog2_zoom = 1.00             
    $game_system.fog2_opacity = 255   
    $game_system.fog2_blend_type = 0
    $game_system.fog2_ox = 0
    $game_system.fog2_oy = 0
   
    $game_system.fog3_name = ""
    $game_system.fog3_zoom = 1.00             
    $game_system.fog3_opacity = 255   
    $game_system.fog3_blend_type = 0
    $game_system.fog3_ox = 0
    $game_system.fog3_oy = 0 
   
    $game_system.fog4_name = ""
    $game_system.fog4_zoom = 1.00             
    $game_system.fog4_opacity = 255   
    $game_system.fog4_blend_type = 0
    $game_system.fog4_ox = 0
    $game_system.fog4_oy = 0
  end
 
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias dispose_multifog dispose
  def dispose
    [@fog2, @fog3, @fog4].each {|i| i.dispose}
    dispose_multifog
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_multifog update
  def update
   
    if @fog2_name == nil
      v1, v2, v3 = @viewport1, @viewport2, @viewport3
      multifog(v1,v2,v3)
    end
 
    if $game_system.fog2_name == nil 
      system_fog_setup
    end
   
    #---------------------------------------------------------------------------
    # FOG 2
    #---------------------------------------------------------------------------
    if @fog2_name != $game_system.fog2_name
      @fog2_name = $game_system.fog2_name
      if @fog2.bitmap != nil
          @fog2.bitmap.dispose
          @fog2.bitmap = nil
      end
      if @fog2_name != ""
          @fog2.bitmap = RPG::Cache.fog(@fog2_name, 0)
      end
      Graphics.frame_reset
    end   
    @fog2.opacity = 255
    @fog2.blend_type = $game_system.fog2_blend_type
    @fog2_ox += $game_system.fog2_ox
    @fog2_oy += $game_system.fog2_oy   
    @fog2.ox = $game_map.display_x / 3 + ($game_player.screen_x / 3 ) + @fog2_ox
    @fog2.oy = $game_map.display_y / 3 +  @fog2_oy
   
    #---------------------------------------------------------------------------
    # FOG 3
    #---------------------------------------------------------------------------   
    if @fog3_name != $game_system.fog3_name
      @fog3_name = $game_system.fog3_name
      if @fog3.bitmap != nil
          @fog3.bitmap.dispose
          @fog3.bitmap = nil
      end
      if @fog3_name != ""
          @fog3.bitmap = RPG::Cache.fog(@fog3_name, 0)
      end
      Graphics.frame_reset
    end 
    @fog3.opacity = 255
    @fog3_ox += $game_system.fog3_ox
    @fog3_oy += $game_system.fog3_oy       
    @fog3.ox = $game_map.display_x / 3 + ($game_player.screen_x / 2 ) + @fog3_ox
    @fog3.oy = $game_map.display_y / 4 + @fog3_oy 
   
    #---------------------------------------------------------------------------
    # FOG 4
    #---------------------------------------------------------------------------   
    if @fog4_name != $game_system.fog4_name
      @fog4_name = $game_system.fog4_name
      if @fog4.bitmap != nil
          @fog4.bitmap.dispose
          @fog4.bitmap = nil
      end
      if @fog4_name != ""
          @fog4.bitmap = RPG::Cache.fog(@fog4_name, 0)
      end
      Graphics.frame_reset
    end 
    @fog4.opacity = 255
    @fog4_ox += $game_system.fog4_ox
    @fog4_oy += $game_system.fog4_oy       
    @fog4.ox = $game_map.display_x / 3 + ($game_player.screen_x / 2 ) + @fog4_ox
    @fog4.oy = $game_map.display_y / 4 + @fog4_oy 
    #---------------------------------------------------------------------------
    update_multifog
  end
end

class Interpreter
 
  def set_fog2(n = "",ox = 0,oy = 0)
    $game_system.fog2_name = n
    $game_system.fog2_ox = ox
    $game_system.fog2_oy = oy
  end
   
  def set_fog3(n = "",ox = 0,oy = 0)
    $game_system.fog3_name = n
    $game_system.fog3_ox = ox
    $game_system.fog3_oy = oy 
  end
   
  def set_fog4(n = "",ox = 0,oy = 0)
    $game_system.fog4_name = n
    $game_system.fog4_ox = ox
    $game_system.fog4_oy = oy
  end
 
  def reset_fog
    set_fog2("", 0, 0)
    set_fog3("", 0, 0)
    set_fog4("", 0, 0)
  end
end

#===============================================================================
# ■ GAME_SYSTEM
#===============================================================================
class Game_System
  attr_accessor :fog2_name   
  attr_accessor :fog2_zoom             
  attr_accessor :fog2_opacity     
  attr_accessor :fog2_blend_type
  attr_accessor :fog2_ox
  attr_accessor :fog2_oy
 
  attr_accessor :fog3_name   
  attr_accessor :fog3_zoom             
  attr_accessor :fog3_opacity     
  attr_accessor :fog3_blend_type
  attr_accessor :fog3_ox
  attr_accessor :fog3_oy   
 
  attr_accessor :fog4_name   
  attr_accessor :fog4_zoom             
  attr_accessor :fog4_opacity     
  attr_accessor :fog4_blend_type
  attr_accessor :fog4_ox
  attr_accessor :fog4_oy
 #--------------------------------------------------------------------------
 # ● Initialize
 #--------------------------------------------------------------------------       
 alias drago_multifog_init initialize
 def initialize
  drago_multifog_init
  @fog2_name = @fog3_name = @fog4_name = ""
  @fog2_zoom = @fog3_zoom = @fog4_zoom = 1.00           
  @fog2_opacity    = @fog3_opacity    = @fog4_opacity    = 255 
  @fog2_blend_type = @fog3_blend_type = @fog4_blend_type = 0
  @fog2_ox = @fog3_ox = @fog4_ox = @fog2_oy = @fog3_oy = @fog4_oy = 0 
 end 
end 


cara pakenya :

panggil di skrip editor

Code:
set_fog2(n,ox ,oy)
set_fog3(n,ox ,oy)
set_fog4(n,ox ,oy)


bedanya fog2, fog3, fog4 ada di viewportnya

n = nama fog (liat di bagian folder fog => harus string (" "))
ox = geser vertikalnya, mesti integer (positif geser kanan, negatif geser kiri)
oy = geser horizontalnya, (positif geser bawah, negatif geser atas)

kalo mau reset fog panggil di skrip editornya

Code:
reset_fog




Penulis : Irgi Kusuma ~ Sebuah blog yang menyediakan berbagai macam informasi

Artikel Multiple Fog ini dipublish oleh Irgi Kusuma pada hari Minggu, 26 Februari 2012. Semoga artikel ini dapat bermanfaat.Terimakasih atas kunjungan Anda silahkan tinggalkan komentar.sudah ada 0 komentar: di postingan Multiple Fog
 

0 komentar:

Posting Komentar