昨天在RGSS区看了这样一贴,
http://bbs.rpgchina.com/dispbbs.asp?boardID=38&ID=8452&page=1
由于高手不放脚本,本人回去试验,结果成功了
效果:

脚本如下:
使用方法:在main脚本前插入新的脚本,名字自定,内容以下........
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
attr_accessor :zoom
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :actor_in_battlefield
alias mohock_battler_setup setup
def setup(actor_id)
mohock_battler_setup(actor_id)
@actor_in_battlefield = false if @actor_in_battlefield != true
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
attr_reader :actor_in_battlefield
alias mohock_battler_initialize initialize
def initialize(troop_id, member_index)
@actor_in_battlefield = false
@x_pos = $data_troops[troop_id].members[member_index].x - 320
@y_pos = -($data_troops[troop_id].members[member_index].y - 304)
@field_x_offset = -192
@field_y_offset = -144
@z_pos = 0
@zoom = 1.00
mohock_battler_initialize(troop_id, member_index)
end
def screen_x
return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x.to_i) * @zoom
end
def screen_y
return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y.to_i) * @zoom
end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
alias mohock_battler_initialize initialize
def initialize
@now_bg_x = 0
@now_bg_y = 0
@now_bg_z = 185
mohock_battler_initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport1 = Viewport.new(-192, -144, 1024, 768)
@battleback_name = ""
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
@battleback_sprite = Sprite.new(@viewport1)
@weather = RPG::Weather.new(@viewport1)
update
end
#==============================================================================
# ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
#==============================================================================
alias mohock_battler_update update
def update
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
bg_bitmap = RPG::Cache.battleback(@battleback_name)
bg_bitmap_stretch = Bitmap.new(1024, 768)
bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
@battleback_sprite.bitmap = bg_bitmap_stretch
end
if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
zoom = 1.00 * 185 / $xcam_z
@battleback_sprite.zoom_x = zoom
@battleback_sprite.zoom_y = zoom
maximum = 192 * (296 - $xcam_z) / 111
$xcam_x = [[$xcam_x, -maximum].max, maximum].min
@battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
@battleback_sprite.y = $xcam_y * zoom - 384 * (zoom - 1)
@battleback_sprite.x = 0
@battleback_sprite.y = 0
@now_bg_x = $xcam_x
@now_bg_y = $xcam_y
@now_bg_z = $xcam_z
end
mohock_battler_update
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
alias mohock_battler_main main
def main
$xcam_x = 0
$xcam_y = 0
$xcam_z = 295
@xcam_x_destination = 0
@xcam_y_destination = 0
@xcam_z_destination = 185
@xcam_watch_battler = nil
@wait_count_xcam = 0
mohock_battler_main
end
end
[此贴子已经被作者于2005-2-22 11:53:16编辑过] |