Advertisement
FlipelyFlip

Battle Mist VXA

Feb 19th, 2013
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.10 KB | None | 0 0
  1. #==============================================================================
  2. # RGSS2_バトルミスト (Battle Mist)
  3. # Original Script by tomoaky (http://hikimoki.sakura.ne.jp)
  4. # Translation by Zak (http://www.rpgmaker-reload.de)
  5. #
  6. # 2010/03/29  Small changes to the display size of the mist, etc.
  7. # 2010/01/04  Released
  8. #
  9. # Adds a Battle Mist to the Battle Scene.
  10. #
  11. # This script needs a file named "mist",
  12. # insert it into the Graphics/System-folder
  13. # In line 32 it's possible to change the name of the file.
  14. #==============================================================================
  15.  
  16. #==============================================================================
  17. # □ Manual
  18. #==============================================================================
  19. module BMIST
  20.   SW_NOUSE = 8 #Switch-ID to turn the script on/off
  21. end
  22.  
  23. #==============================================================================
  24. # ■ Sprite_Mist
  25. #==============================================================================
  26. class Sprite_Mist < Sprite
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize(viewport)
  31.     super(viewport)
  32.     self.bitmap = Cache.system("mist")
  33.     self.blend_type = 1
  34.     self.ox = 128
  35.     self.oy = 90
  36.     self.y = Graphics.height - 128 - self.oy + rand(32)
  37.     setup
  38.     self.x = rand(Graphics.width)
  39.     @real_x = self.x << 10
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● セットアップ
  43.   #--------------------------------------------------------------------------
  44.   def setup
  45.     @vx = rand(512) + 256
  46.     self.zoom_x = (rand(600) + 700) / 1200.0
  47.     if self.zoom_x < 1.0    # バトラーの奥に配置
  48.       self.z = 2
  49.     else                    # バトラーの手前に配置
  50.       self.z = 1000
  51.     end
  52.     self.zoom_y = self.zoom_x
  53.     self.x = Graphics.width + (128 * self.zoom_x).to_i
  54.     @real_x = self.x << 10
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 解放
  58.   #--------------------------------------------------------------------------
  59.   def dispose
  60.     self.bitmap.dispose
  61.     super
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 更新
  65.   #--------------------------------------------------------------------------
  66.   def update
  67.     super
  68.     @real_x -= @vx
  69.     self.x = @real_x >> 10
  70.     setup if self.x < (0 - (128 * self.zoom_x).to_i)
  71.   end
  72. end
  73.  
  74. #==============================================================================
  75. # ■ Spriteset_Battle
  76. #==============================================================================
  77. class Spriteset_Battle
  78.   #--------------------------------------------------------------------------
  79.   # ● バトルバックスプライトの作成
  80.   #--------------------------------------------------------------------------
  81.   alias bmist_spriteset_battle_create_battleback create_battleback2
  82.   def create_battleback2
  83.     bmist_spriteset_battle_create_battleback
  84.     @mist_sprites = []
  85.     unless $game_switches[BMIST::SW_NOUSE]
  86.       for i in 0...8 do @mist_sprites.push(Sprite_Mist.new(@viewport1)) end
  87.     end
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● バトルバックスプライトの解放
  91.   #--------------------------------------------------------------------------
  92.   alias bmist_spriteset_battle_dispose_battleback dispose_battleback2
  93.   def dispose_battleback2
  94.     bmist_spriteset_battle_dispose_battleback
  95.     for sprite in @mist_sprites do sprite.dispose end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● バトルバックの更新
  99.   #--------------------------------------------------------------------------
  100.   alias bmist_spriteset_battle_update_battleback update_battleback2
  101.   def update_battleback2
  102.     bmist_spriteset_battle_update_battleback
  103.     for sprite in @mist_sprites do sprite.update end
  104.   end
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement