Project1

标题: 【仿VA任重而道远】双战斗背景 [打印本页]

作者: 阿尔西斯的马甲    时间: 2012-1-17 14:28
标题: 【仿VA任重而道远】双战斗背景
本帖最后由 阿尔西斯的马甲 于 2012-1-19 20:30 编辑
  1. class Spriteset_Battle
  2.   def initialize
  3.     @viewport1 = Viewport.new(0, 0, 640, 320)
  4.     @viewport2 = Viewport.new(0, 0, 640, 480)
  5.     @viewport3 = Viewport.new(0, 0, 640, 480)
  6.     @viewport4 = Viewport.new(0, 0, 640, 480)
  7.     @viewport2.z = 101
  8.     @viewport3.z = 200
  9.     @viewport4.z = 5000
  10.     @battleback_sprite = Sprite.new(@viewport1)
  11.     @battleback_sprite2 = Sprite.new(@viewport1)
  12.     @enemy_sprites = []
  13.     for enemy in $game_troop.enemies.reverse
  14.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  15.     end
  16.     @actor_sprites = []
  17.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  18.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  19.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  20.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  21.     @weather = RPG::Weather.new(@viewport1)
  22.     @picture_sprites = []
  23.     for i in 51..100
  24.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  25.         $game_screen.pictures[i]))
  26.     end
  27.     @timer_sprite = Sprite_Timer.new
  28.     update
  29.   end
  30.   def dispose
  31.     if @battleback_sprite.bitmap != nil
  32.       @battleback_sprite.bitmap.dispose
  33.     end
  34.     if @battleback_sprite2.bitmap != nil
  35.       @battleback_sprite.bitmap.dispose
  36.     end
  37.     @battleback_sprite.dispose
  38.     @battleback_sprite2.dispose
  39.     for sprite in @enemy_sprites + @actor_sprites
  40.       sprite.dispose
  41.     end
  42.     @weather.dispose
  43.     for sprite in @picture_sprites
  44.       sprite.dispose
  45.     end
  46.     @timer_sprite.dispose
  47.     @viewport1.dispose
  48.     @viewport2.dispose
  49.     @viewport3.dispose
  50.     @viewport4.dispose
  51.   end
  52.   def update
  53.     @actor_sprites[0].battler = $game_party.actors[0]
  54.     @actor_sprites[1].battler = $game_party.actors[1]
  55.     @actor_sprites[2].battler = $game_party.actors[2]
  56.     @actor_sprites[3].battler = $game_party.actors[3]
  57.     if @battleback_name != $game_temp.battleback_name
  58.       @battleback_name = $game_temp.battleback_name
  59.       if @battleback_sprite.bitmap != nil
  60.         @battleback_sprite.bitmap.dispose
  61.       end
  62.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  63.       @battleback_sprite.src_rect.set(0, 0, 640, 320)
  64.       if @battleback_sprite2.bitmap != nil
  65.         @battleback_sprite2.bitmap.dispose
  66.       end
  67.       @battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
  68.       @battleback_sprite2.src_rect.set(0, 0, 640, 320)
  69.     end
  70.     for sprite in @enemy_sprites + @actor_sprites
  71.       sprite.update
  72.     end
  73.     @weather.type = $game_screen.weather_type
  74.     @weather.max = $game_screen.weather_max
  75.     @weather.update
  76.     for sprite in @picture_sprites
  77.       sprite.update
  78.     end
  79.     @timer_sprite.update
  80.     @viewport1.tone = $game_screen.tone
  81.     @viewport1.ox = $game_screen.shake
  82.     @viewport4.color = $game_screen.flash_color
  83.     @viewport1.update
  84.     @viewport2.update
  85.     @viewport4.update
  86.   end
  87. end
复制代码
把VA的战斗背景转成640×480,
改成 BTBK BTBK_2的格式(听说过双远景么?就是这个格式)
然后放到Battleback文件夹里,图块里战斗背景选第一个。这样就可以做出双战斗背景的效果了。
(不支持RTAB。其实RTAB版本我也做出来了,就是没插件化)
RTAB版插件化了。如下:
  1. class Spriteset_Battle
  2.   def initialize
  3.     @viewport1 = Viewport.new(0, 0, 640, 480)
  4.     @viewport2 = Viewport.new(0, 0, 640, 480)
  5.     @viewport3 = Viewport.new(0, 0, 640, 480)
  6.     @viewport4 = Viewport.new(0, 0, 640, 480)
  7.     @viewport2.z = 101
  8.     @viewport3.z = 200
  9.     @viewport4.z = 5000
  10.     @wait = 0
  11.     @real_x = 0
  12.     @real_y = 0
  13.     @real_zoom = 1.0
  14.     @target_x = 0
  15.     @target_y = 0
  16.     @target_zoom = 1.0
  17.     @gap_x = 0
  18.     @gap_y = 0
  19.     @gap_zoom = 0.0
  20.     @battleback_sprite = Sprite.new(@viewport1)
  21.     @battleback_sprite2 = Sprite.new(@viewport1)
  22.     @enemy_sprites = []
  23.     for enemy in $game_troop.enemies.reverse
  24.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  25.     end
  26.     @actor_sprites = []
  27.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  28.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  29.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  30.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  31.     @weather = RPG::Weather.new(@viewport1)
  32.     @picture_sprites = []
  33.     for i in 51..100
  34.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  35.         $game_screen.pictures[i]))
  36.     end
  37.     @timer_sprite = Sprite_Timer.new
  38.     update
  39.   end
  40.   def make_battleback
  41.     @battleback_name = $game_temp.battleback_name
  42.     if @battleback_sprite.bitmap != nil
  43.       @battleback_sprite.bitmap.dispose
  44.     end
  45.     if @battleback_sprite2.bitmap != nil
  46.       @battleback_sprite2.bitmap.dispose
  47.     end
  48.     @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  49.     @battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
  50.     if @battleback_sprite.bitmap.width == 640 and
  51.        @battleback_sprite.bitmap.height == 320
  52.       @battleback_sprite.src_rect.set(0, 0, 1280, 640)
  53.       @base_zoom = 2.0
  54.       @battleback_sprite.zoom_x = @base_zoom
  55.       @battleback_sprite.zoom_y = @base_zoom
  56.       @real_y = 4
  57.       @battleback_sprite.x = 320
  58.       @battleback_sprite.y = @real_y
  59.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  60.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  61.     elsif @battleback_sprite.bitmap.width == 640 and
  62.           @battleback_sprite.bitmap.height == 480
  63.       @battleback_sprite.src_rect.set(0, 0, 960, 720)
  64.       @base_zoom = 1.5
  65.       @battleback_sprite.zoom_x = @base_zoom
  66.       @battleback_sprite.zoom_y = @base_zoom
  67.       @battleback_sprite.x = 320
  68.       @battleback_sprite.y = 0
  69.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  70.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  71.     else
  72.       @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
  73.                                       @battleback_sprite.bitmap.height)
  74.       @base_zoom = 1.0
  75.       @battleback_sprite.zoom_x = @base_zoom
  76.       @battleback_sprite.zoom_y = @base_zoom
  77.       @battleback_sprite.x = 320
  78.       @battleback_sprite.y = 0
  79.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  80.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  81.     end
  82.     if @battleback_sprite2.bitmap.width == 640 and
  83.        @battleback_sprite2.bitmap.height == 320
  84.       @battleback_sprite2.src_rect.set(0, 0, 1280, 640)
  85.       @base_zoom = 2.0
  86.       @battleback_sprite2.zoom_x = @base_zoom
  87.       @battleback_sprite2.zoom_y = @base_zoom
  88.       @real_y = 4
  89.       @battleback_sprite2.x = 320
  90.       @battleback_sprite2.y = @real_y
  91.       @battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
  92.       @battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
  93.     elsif @battleback_sprite2.bitmap.width == 640 and
  94.           @battleback_sprite2.bitmap.height == 480
  95.       @battleback_sprite2.src_rect.set(0, 0, 960, 720)
  96.       @base_zoom = 1.5
  97.       @battleback_sprite2.zoom_x = @base_zoom
  98.       @battleback_sprite2.zoom_y = @base_zoom
  99.       @battleback_sprite2.x = 320
  100.       @battleback_sprite2.y = 0
  101.       @battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
  102.       @battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
  103.     else
  104.       @battleback_sprite2.src_rect.set(0, 0, @battleback_sprite2.bitmap.width,
  105.                                       @battleback_sprite2.bitmap.height)
  106.       @base_zoom = 1.0
  107.       @battleback_sprite2.zoom_x = @base_zoom
  108.       @battleback_sprite2.zoom_y = @base_zoom
  109.       @battleback_sprite2.x = 320
  110.       @battleback_sprite2.y = 0
  111.       @battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
  112.       @battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
  113.     end
  114.   end
  115.   def screen_scroll
  116.     if @wait > 0
  117.       @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
  118.       @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
  119.       @real_zoom = @target_zoom -
  120.                     @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
  121.       @battleback_sprite.x = 320 + @real_x
  122.       @battleback_sprite.y = @real_y
  123.       @battleback_sprite.zoom_x = @base_zoom * @real_zoom
  124.       @battleback_sprite.zoom_y = @base_zoom * @real_zoom
  125.       @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
  126.       @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
  127.       @battleback_sprite2.x = 320 + @real_x
  128.       @battleback_sprite2.y = @real_y
  129.       @battleback_sprite2.zoom_x = @base_zoom * @real_zoom
  130.       @battleback_sprite2.zoom_y = @base_zoom * @real_zoom
  131.       @battleback_sprite2.ox = @battleback_sprite.bitmap.width / 2
  132.       @battleback_sprite2.oy = @battleback_sprite.bitmap.height / 4
  133.       @wait -= 1
  134.     end
  135.   end
  136. def update
  137.     @actor_sprites[0].battler = $game_party.actors[0]
  138.     @actor_sprites[1].battler = $game_party.actors[1]
  139.     @actor_sprites[2].battler = $game_party.actors[2]
  140.     @actor_sprites[3].battler = $game_party.actors[3]
  141.     if @battleback_name != $game_temp.battleback_name
  142.       @battleback_name = $game_temp.battleback_name
  143.       if @battleback_sprite.bitmap != nil
  144.         @battleback_sprite.bitmap.dispose
  145.       end
  146.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  147.       @battleback_sprite.src_rect.set(0, 0, 640, 320)
  148.       if @battleback_sprite2.bitmap != nil
  149.         @battleback_sprite2.bitmap.dispose
  150.       end
  151.       @battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
  152.       @battleback_sprite2.src_rect.set(0, 0, 640, 320)
  153.     end
  154.     for sprite in @enemy_sprites + @actor_sprites
  155.       sprite.update
  156.     end
  157.     @weather.type = $game_screen.weather_type
  158.     @weather.max = $game_screen.weather_max
  159.     @weather.update
  160.     for sprite in @picture_sprites
  161.       sprite.update
  162.     end
  163.     @timer_sprite.update
  164.     @viewport1.tone = $game_screen.tone
  165.     @viewport1.ox = $game_screen.shake
  166.     @viewport4.color = $game_screen.flash_color
  167.     @viewport1.update
  168.     @viewport2.update
  169.     @viewport4.update
  170.   end
  171. end
复制代码
如果你的RTAB附带了一个
戦闘背景暗転化スクリプトver.1.11(RTAB用)
并且你想让第二块战斗背景也暗転化,请加入以下补丁:
  1. class Spriteset_Battle
  2. def update
  3.     @actor_sprites[0].battler = $game_party.actors[0]
  4.     @actor_sprites[1].battler = $game_party.actors[1]
  5.     @actor_sprites[2].battler = $game_party.actors[2]
  6.     @actor_sprites[3].battler = $game_party.actors[3]
  7.     if @battleback_name != $game_temp.battleback_name
  8.       @battleback_name = $game_temp.battleback_name
  9.       if @battleback_sprite.bitmap != nil
  10.         @battleback_sprite.bitmap.dispose
  11.       end
  12.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  13.       @battleback_sprite.src_rect.set(0, 0, 640, 320)
  14.       if @battleback_sprite2.bitmap != nil
  15.         @battleback_sprite2.bitmap.dispose
  16.       end
  17.       @battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
  18.       @battleback_sprite2.src_rect.set(0, 0, 640, 320)
  19.     end
  20.     for sprite in @enemy_sprites + @actor_sprites
  21.       sprite.update
  22.     end
  23.     @weather.type = $game_screen.weather_type
  24.     @weather.max = $game_screen.weather_max
  25.     @weather.update
  26.     for sprite in @picture_sprites
  27.       sprite.update
  28.     end
  29.     @timer_sprite.update
  30.     @viewport1.tone = $game_screen.tone
  31.     @viewport1.ox = $game_screen.shake
  32.     @viewport4.color = $game_screen.flash_color
  33.     @viewport1.update
  34.     @viewport2.update
  35.     @viewport4.update
  36. if $game_temp.black_flug && @battleback_sprite.tone.red != -TONE_MARGINAL
  37.       @battleback_sprite.tone.red -= BLACK_R
  38.       @battleback_sprite.tone.green -= BLACK_G
  39.       @battleback_sprite.tone.blue -= BLACK_B
  40.       @battleback_sprite2.tone.red -= BLACK_R
  41.       @battleback_sprite2.tone.green -= BLACK_G
  42.       @battleback_sprite2.tone.blue -= BLACK_B
  43.     elsif !$game_temp.black_flug && @battleback_sprite.tone.red != 0
  44.       @battleback_sprite.tone.red += BLACK_R
  45.       @battleback_sprite.tone.green += BLACK_G
  46.       @battleback_sprite.tone.blue += BLACK_B
  47.       @battleback_sprite2.tone.red += BLACK_R
  48.       @battleback_sprite2.tone.green += BLACK_G
  49.       @battleback_sprite2.tone.blue += BLACK_B
  50.     end
  51.   end
  52. end
复制代码
注意,一定要把脚本放在Main前,
如果是RTAB版,还要放在整个RTAB后。
不知道我是怎么灵感爆发写出这脚本的。后来想重写就写不出来了= =
作者: 越前リョーマ    时间: 2012-1-17 14:51
感觉这个只是制作组合图时方便……实际没什么用吧,不如直接拿PS拼……




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1