Parallax & Fog Autoscroll in XP



Pengenalan

Script ini menambahkan auto scroll pada parallax (panorama) sehingga dapat bergeser secara terus menerus seperti di RMVX, dengan cara memanipulasi kelas Spriteset_Map. Namun tidak hanya untuk parallax, tapi juga untuk fog.





FAQ

Q: Apa itu parallax/panorama?
A: Ya background lah :v

Q: Bisa tolong bikin script autoscroll fog buat RMVX ga?
A: Sori masih lum sempet, maklum udah karatan :hammer:

Q: Apakah ada kemungkinan bentrok ama script lain?
A: Kayanya ga mungkin deh, soalnya script nya cukup sederhana

Q: Tapi.. gimana dengan script multiple fog nya littledrago?
A: Nah, buat yg ini kayanya bentrok deh, jadi pikirin sendiri gimana cara nyatuinnya :v

Q: Saat demonya di-run, ada masalah missing font
A: Demo ini emang pake custom font, yang dibutuhkan font yg namanya "Gabriola". Silahkan instal dulu font nya, atau hilangkan bagian
Code:
Font.default_name = "Gabriola"
  Font.default_size = 40

di script bagian Main kalo pengen pake font default nya

Q: Di demonya kok fog nya kayak blizzard? :v
A: Biz, bingung nih mo pake fog apa buat parallax luar angkasa sih =))



Screenshot

Spoiler:


http://i.imgur.com/ICfQa.png



Demo

Link:
- Mediafire
- http://ifile.it/0nxkhys (mirror, still in older version)


Script
Code:
#==============================================================================
# Parallax & Fog Autoscroll in XP
# for RPG Maker XP
# Version 1.1
#==============================================================================
# Information:
#  This script makes parallaxes (panoramas) able to Autoscroll, like in RMVX
#  and also makes fogs able to Autoscroll.
#
#  Autoscroll can be configured in CustomParallax section at this script.
#  Note that the array index is map ID for the parallax & fog.
#
# Credit
#  Alissa Liu
#
#==============================================================================

#==============================================================================
# ** CustomParallax
#------------------------------------------------------------------------------
#  Define parallax (panorama) and fog autoscroll values here.
#==============================================================================

class CustomParallax
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :parallax_scrollx
  attr_accessor :parallax_scrolly
  attr_accessor :fog_scrollx
  attr_accessor :fog_scrolly
  def initialize
    @parallax_scrollx = [0,3]
    @parallax_scrolly = [0,2] 
    @fog_scrollx = [0,3]
    @fog_scrolly = [0,2]
  end
  def p_chg_scrollx(val)
    @parallax_scrollx[$game_map.map_id] = val
  end
  def p_chg_scrolly(val)
    @parallax_scrolly[$game_map.map_id] = val
  end
  def f_chg_scrollx(val)
    @fog_scrollx[$game_map.map_id] = val
  end
  def f_chg_scrolly(val)
    @fog_scrolly[$game_map.map_id] = val
  end
end

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

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias cp_init initialize
  def initialize
    $cp = CustomParallax.new
    @p_scrollx = 0
    @p_scrolly = 0
    @f_scrollx = 0
    @f_scrolly = 0
    cp_init
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias cp_update update
  def update
    cp_update
    # Update panorama plane
    if @panorama.bitmap != nil
      @p_scrollx = (@p_scrollx+$cp.parallax_scrollx[$game_map.map_id]+@panorama.bitmap.width) % @panorama.bitmap.width
      @p_scrolly = (@p_scrolly+$cp.parallax_scrolly[$game_map.map_id]+@panorama.bitmap.height) % @panorama.bitmap.height
      @panorama.ox = $game_map.display_x / 8 + @p_scrollx
      @panorama.oy = $game_map.display_y / 8 + @p_scrolly
    end
    # Update fog plane
    if @fog.bitmap != nil
      @f_scrollx = (@f_scrollx+$cp.fog_scrollx[$game_map.map_id]+@fog.bitmap.width) % @fog.bitmap.width
      @f_scrolly = (@f_scrolly+$cp.fog_scrolly[$game_map.map_id]+@fog.bitmap.height) % @fog.bitmap.height
      @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox + @f_scrollx*2
      @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy + @f_scrolly*2
    end
  end
end


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

Artikel Parallax & Fog Autoscroll in XP 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 Parallax & Fog Autoscroll in XP
 

0 komentar:

Posting Komentar