- 注册时间
- 2006-9-10
- 最后登录
- 2006-9-11
②入门
- 积分
- 35
|

楼主 |
发表于 2006-9-11 11:39:01
|
显示全部楼层
不是呀~里面就缺个”我攻击敌人放大倍率呀”
那些蓝色的字是我自己加的……
我加过结果都是我攻击前会放大一下 然后会回复原尺寸打敌人
而不是放大打敌人
帮帮忙吧~大哥
附上原本rgss的网址 先谢了
http://home.pchome.com.tw/star/s912204/77/123/44.htm
- # ▼▲▼ XRXS_BP 8. バトルバック?Full-View+可動カメラ ver..05d ▼▲▼
- # by 櫻雅 在土
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 追加?公開インスタンス變數
- #--------------------------------------------------------------------------
- attr_accessor :x_pos # バトルフィールド 橫 位置(+が右 )
- attr_accessor :y_pos # バトルフィールド 高さ 位置(+が上 )
- attr_accessor :z_pos # バトルフィールド奧行き位置(+が手前)
- attr_accessor :zoom # 現在のズーム倍率
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 追加?公開インスタンス變數
- #--------------------------------------------------------------------------
- attr_reader :actor_in_battlefield # アクターもフィールドに
- #--------------------------------------------------------------------------
- # ● セットアップ
- #--------------------------------------------------------------------------
- alias xrxs_bp8_setup setup
- def setup(actor_id)
- xrxs_bp8_setup(actor_id)
- # 機能"アクターもフィールドに"
- # trueを優先する
- @actor_in_battlefield = false if @actor_in_battlefield != true
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 追加?公開インスタンス變數
- #--------------------------------------------------------------------------
- attr_reader :actor_in_battlefield # アクターもフィールドに
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias xrxs_bp8_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
- xrxs_bp8_initialize(troop_id, member_index)
- end
- #--------------------------------------------------------------------------
- # ● バトル畫面 X 座標の取得
- #--------------------------------------------------------------------------
- def screen_x
- $xcam_x = 0 if $xcam_x == nil
- return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x) * @zoom
- end
- #--------------------------------------------------------------------------
- # ● バトル畫面 Y 座標の取得
- #--------------------------------------------------------------------------
- def screen_y
- $xcam_y = 0 if $xcam_y == nil
- return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y) * @zoom
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update update
- def update
- # 初期化
- @z_offset = 0
- # 戾す
- xrxs_bp8_update
- # バトラーが nil の場合戾る
- return if @battler == nil
- # 敵のみにカメラが影響。
- # 見方もバトルフィールドにいる場合ここの if を外す。
- if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
- # ズーム率
- zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
- self.zoom_x = zoom
- self.zoom_y = zoom
- @battler.zoom = zoom
- # スプライトの座標を設定
- self.x = @battler.screen_x
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias xrxs_bp8_initialize initialize
- def initialize
- # 初期化
- @now_bg_x = -1
- @now_bg_y = -1
- @now_bg_z = -1
- # 通常時の實行
- xrxs_bp8_initialize
- # ビューポートを作成
- @viewport1 = Viewport.new(-192, -144, 1024, 768)
- # バトルバックスプライトを作成
- @battleback_sprite = Sprite.new(@viewport1)
- @battleback_name = ""
- # エネミースプライトを作成
- @enemy_sprites = []
- for enemy in $game_troop.enemies.reverse
- @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
- end
- # 天候を作成
- @weather = RPG::Weather.new(@viewport1)
- # フレーム更新
- update
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias xrxs_bp8_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
- # カメラzによる位置の修正
- 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)
- # 值更新
- @now_bg_x = $xcam_x
- @now_bg_y = $xcam_y
- @now_bg_z = $xcam_z
- end
- # 戾す
- xrxs_bp8_update
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● メイン處理
- #--------------------------------------------------------------------------
- alias xrxs_bp8_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
- # 戾す
- xrxs_bp8_main
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update update
- def update
- # カメラ位置の更新。
- if @wait_count_xcam > 0
- # ウェイトカウントを減らす
- @wait_count_xcam -= 1
- else
- # カメラ: Z 座標
- if $xcam_z != @xcam_z_destination
- if $xcam_z < @xcam_z_destination
- distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
- else
- distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
- end
- $xcam_z = [[$xcam_z + distance, 74].max, 296].min
- end
- # カメラ: X 座標
- if @xcam_watch_battler != nil
- if $xcam_x != @xcam_watch_battler.x_pos
- if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
- distance = @xcam_watch_battler.x_pos - $xcam_x
- elsif $xcam_x < @xcam_watch_battler.x_pos
- distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
- else
- distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
- end
- maximum = 192 * (296 - $xcam_z) / 111
- $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
- end
- elsif $xcam_x != @xcam_x_destination
- if ($xcam_x - @xcam_x_destination).abs < 8
- distance = @xcam_x_destination - $xcam_x
- elsif $xcam_x < @xcam_x_destination
- distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
- else
- distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
- end
- maximum = 192 * (296 - $xcam_z) / 111
- $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
- end
- # カメラ: Y 座標
- if @xcam_watch_battler != nil
- y = @xcam_watch_battler.y_pos/2
- if $xcam_y != y
- if ($xcam_y - y).abs < 8
- distance = y - $xcam_y
- elsif $xcam_y < y
- distance = [(y - $xcam_y)/8, 8].max
- else
- distance = [(y - $xcam_y)/8, -8].min
- end
- maximum = 144 * (296 - $xcam_z) / 111
- $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
- end
- elsif $xcam_y != @xcam_y_destination
- if $xcam_y < @xcam_y_destination
- distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
- else
- distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
- end
- maximum = 164 * (296 - $xcam_z) / 111
- $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
- end
- end
- # 通常實行
- xrxs_bp8_update
- end
- #--------------------------------------------------------------------------
- # ● パーティコマンドフェーズ開始
- #--------------------------------------------------------------------------
- alias xrxs_bp8_start_phase2 start_phase2
- def start_phase2
- # カメラ:センタリング
- @xcam_watch_battler = nil
- @xcam_x_destination = 0
- @xcam_z_destination = 185
- # 戾す
- xrxs_bp8_start_phase2
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アクターコマンドフェーズ)
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update_phase3 update_phase3
- def update_phase3
- # カメラをキャラ位置へ
- if @active_battler != nil and @active_battler.actor_in_battlefield
- @xcam_x_destination = @active_battler.x_pos
- @xcam_z_destination = 175
- end
- xrxs_bp8_update_phase3
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アクターコマンドフェーズ : エネミー選擇)
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
- def update_phase3_enemy_select
- # カメラ:敵ターゲットをズームアップ
- @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
- @xcam_z_destination = 175
- # 戾す
- xrxs_bp8_update_phase3_enemy_select
- end
- #--------------------------------------------------------------------------
- # ● エネミー選擇終了
- #--------------------------------------------------------------------------
- alias xrxs_bp8_end_enemy_select end_enemy_select
- def end_enemy_select
- # カメラ:中心へ
- @xcam_x_destination = 0
- @xcam_z_destination = 185
- # 戾す
- xrxs_bp8_end_enemy_select
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update_phase4_step2 update_phase4_step2
- def update_phase4_step2
- # 戾す
- xrxs_bp8_update_phase4_step2
- # ステップ 3 に移行する場合
- if @phase4_step == 3
- if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
- # カメラ:行動バトラーへのズームアップを予約
- @xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
- @xcam_z_destination = 175
- end
- # 最低 20 フレーム待つ
- @wait_count = 20
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
- #--------------------------------------------------------------------------
- alias xrxs_bp8_update_phase4_step3 update_phase4_step3
- def update_phase4_step3
- # 戾す
- xrxs_bp8_update_phase4_step3
- if @target_battlers.size > 0 and
- (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
- # カメラ:ターゲットへのズームアップを予約
- @xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
- @xcam_z_destination = 185
- # もし對像アニメが「位置:畫面」のものの場合
- if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
- # カメラをセンタリング
- @xcam_x_destination = 0
- # ズームアウトまでやっちゃう?w?
- @xcam_z_destination = 222
- end
- end
- # 最低 20 フレーム待つ
- @wait_count = 20
- end
- #--------------------------------------------------------------------------
- # ● アフターバトルフェーズ開始
- #--------------------------------------------------------------------------
- alias xrxs_bp8_start_phase5 start_phase5
- def start_phase5
- @xcam_z_destination = 185
- xrxs_bp8_start_phase5
- end
- end
- #==============================================================================
- # ◇ RPG::再定義「戰鬥中の"畫面"アニメの位置修正」
- #==============================================================================
- module RPG
- class Sprite < ::Sprite
- def animation_set_sprites(sprites, cell_data, position)
- for i in 0..15
- sprite = sprites[i]
- pattern = cell_data[i, 0]
- if sprite == nil or pattern == nil or pattern == -1
- sprite.visible = false if sprite != nil
- next
- end
- sprite.visible = true
- sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
- if position == 3
- if self.viewport != nil
- if $scene.is_a?(Scene_Battle)
- sprite.x = self.viewport.rect.width / 2
- sprite.y = 304
- else
- sprite.x = self.viewport.rect.width / 2
- sprite.y = self.viewport.rect.height - 160
- end
- else
- sprite.x = 320
- sprite.y = 240
- end
- else
- sprite.x = self.x - self.ox + self.src_rect.width / 2
- sprite.y = self.y - self.oy + self.src_rect.height / 2
- sprite.y -= self.src_rect.height / 4 if position == 0
- sprite.y += self.src_rect.height / 4 if position == 2
- end
- sprite.x += cell_data[i, 1]
- sprite.y += cell_data[i, 2]
- sprite.z = 2000
- sprite.ox = 96
- sprite.oy = 96
- sprite.zoom_x = cell_data[i, 3] / 100.0
- sprite.zoom_y = cell_data[i, 3] / 100.0
- sprite.angle = cell_data[i, 4]
- sprite.mirror = (cell_data[i, 5] == 1)
- sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
- sprite.blend_type = cell_data[i, 7]
- end
- end
- end
- end
复制代码 |
|