Project1
标题:
【仿VA任重而道远】双战斗背景
[打印本页]
作者:
阿尔西斯的马甲
时间:
2012-1-17 14:28
标题:
【仿VA任重而道远】双战斗背景
本帖最后由 阿尔西斯的马甲 于 2012-1-19 20:30 编辑
class Spriteset_Battle
def initialize
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
@battleback_sprite = Sprite.new(@viewport1)
@battleback_sprite2 = Sprite.new(@viewport1)
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
def dispose
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
if @battleback_sprite2.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.dispose
@battleback_sprite2.dispose
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
@weather.dispose
for sprite in @picture_sprites
sprite.dispose
end
@timer_sprite.dispose
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
def update
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 320)
if @battleback_sprite2.bitmap != nil
@battleback_sprite2.bitmap.dispose
end
@battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
@battleback_sprite2.src_rect.set(0, 0, 640, 320)
end
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport4.color = $game_screen.flash_color
@viewport1.update
@viewport2.update
@viewport4.update
end
end
复制代码
把VA的战斗背景转成640×480,
改成 BTBK BTBK_2的格式(听说过双远景么?就是这个格式)
然后放到Battleback文件夹里,图块里战斗背景选第一个。这样就可以做出双战斗背景的效果了。
(不支持RTAB。其实RTAB版本我也做出来了,就是没插件化)
RTAB版插件化了。如下:
class Spriteset_Battle
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
@wait = 0
@real_x = 0
@real_y = 0
@real_zoom = 1.0
@target_x = 0
@target_y = 0
@target_zoom = 1.0
@gap_x = 0
@gap_y = 0
@gap_zoom = 0.0
@battleback_sprite = Sprite.new(@viewport1)
@battleback_sprite2 = Sprite.new(@viewport1)
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
def make_battleback
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
if @battleback_sprite2.bitmap != nil
@battleback_sprite2.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
if @battleback_sprite.bitmap.width == 640 and
@battleback_sprite.bitmap.height == 320
@battleback_sprite.src_rect.set(0, 0, 1280, 640)
@base_zoom = 2.0
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@real_y = 4
@battleback_sprite.x = 320
@battleback_sprite.y = @real_y
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
elsif @battleback_sprite.bitmap.width == 640 and
@battleback_sprite.bitmap.height == 480
@battleback_sprite.src_rect.set(0, 0, 960, 720)
@base_zoom = 1.5
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@battleback_sprite.x = 320
@battleback_sprite.y = 0
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
else
@battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
@battleback_sprite.bitmap.height)
@base_zoom = 1.0
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@battleback_sprite.x = 320
@battleback_sprite.y = 0
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
end
if @battleback_sprite2.bitmap.width == 640 and
@battleback_sprite2.bitmap.height == 320
@battleback_sprite2.src_rect.set(0, 0, 1280, 640)
@base_zoom = 2.0
@battleback_sprite2.zoom_x = @base_zoom
@battleback_sprite2.zoom_y = @base_zoom
@real_y = 4
@battleback_sprite2.x = 320
@battleback_sprite2.y = @real_y
@battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
@battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
elsif @battleback_sprite2.bitmap.width == 640 and
@battleback_sprite2.bitmap.height == 480
@battleback_sprite2.src_rect.set(0, 0, 960, 720)
@base_zoom = 1.5
@battleback_sprite2.zoom_x = @base_zoom
@battleback_sprite2.zoom_y = @base_zoom
@battleback_sprite2.x = 320
@battleback_sprite2.y = 0
@battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
@battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
else
@battleback_sprite2.src_rect.set(0, 0, @battleback_sprite2.bitmap.width,
@battleback_sprite2.bitmap.height)
@base_zoom = 1.0
@battleback_sprite2.zoom_x = @base_zoom
@battleback_sprite2.zoom_y = @base_zoom
@battleback_sprite2.x = 320
@battleback_sprite2.y = 0
@battleback_sprite2.ox = @battleback_sprite2.bitmap.width / 2
@battleback_sprite2.oy = @battleback_sprite2.bitmap.height / 4
end
end
def screen_scroll
if @wait > 0
@real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
@real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
@real_zoom = @target_zoom -
@gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
@battleback_sprite.x = 320 + @real_x
@battleback_sprite.y = @real_y
@battleback_sprite.zoom_x = @base_zoom * @real_zoom
@battleback_sprite.zoom_y = @base_zoom * @real_zoom
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
@battleback_sprite2.x = 320 + @real_x
@battleback_sprite2.y = @real_y
@battleback_sprite2.zoom_x = @base_zoom * @real_zoom
@battleback_sprite2.zoom_y = @base_zoom * @real_zoom
@battleback_sprite2.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite2.oy = @battleback_sprite.bitmap.height / 4
@wait -= 1
end
end
def update
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 320)
if @battleback_sprite2.bitmap != nil
@battleback_sprite2.bitmap.dispose
end
@battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
@battleback_sprite2.src_rect.set(0, 0, 640, 320)
end
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport4.color = $game_screen.flash_color
@viewport1.update
@viewport2.update
@viewport4.update
end
end
复制代码
如果你的RTAB附带了一个
戦闘背景暗転化スクリプトver.1.11(RTAB用)
并且你想让第二块战斗背景也暗転化,请加入以下补丁:
class Spriteset_Battle
def update
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 320)
if @battleback_sprite2.bitmap != nil
@battleback_sprite2.bitmap.dispose
end
@battleback_sprite2.bitmap = RPG::Cache.battleback(@battleback_name+"_2")
@battleback_sprite2.src_rect.set(0, 0, 640, 320)
end
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport4.color = $game_screen.flash_color
@viewport1.update
@viewport2.update
@viewport4.update
if $game_temp.black_flug && @battleback_sprite.tone.red != -TONE_MARGINAL
@battleback_sprite.tone.red -= BLACK_R
@battleback_sprite.tone.green -= BLACK_G
@battleback_sprite.tone.blue -= BLACK_B
@battleback_sprite2.tone.red -= BLACK_R
@battleback_sprite2.tone.green -= BLACK_G
@battleback_sprite2.tone.blue -= BLACK_B
elsif !$game_temp.black_flug && @battleback_sprite.tone.red != 0
@battleback_sprite.tone.red += BLACK_R
@battleback_sprite.tone.green += BLACK_G
@battleback_sprite.tone.blue += BLACK_B
@battleback_sprite2.tone.red += BLACK_R
@battleback_sprite2.tone.green += BLACK_G
@battleback_sprite2.tone.blue += BLACK_B
end
end
end
复制代码
注意,一定要把脚本放在Main前,
如果是RTAB版,还要放在整个RTAB后。
不知道我是怎么灵感爆发写出这脚本的。后来想重写就写不出来了= =
作者:
越前リョーマ
时间:
2012-1-17 14:51
感觉这个只是制作组合图时方便……实际没什么用吧,不如直接拿PS拼……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1