|
发表于 2008-9-21 07:29:34
|
显示全部楼层
阿。。。和我的估计一样。。。STR 是 几个放一块用的。。。screen_x是别的脚本定义的。。。
- #==============================================================================
- # ★RGSS2
- # STR11a_XP風バトル#バトラー v1.2 08/01/22
- # サポート:[url]http://otsu.cool.ne.jp/strcatyou/[/url]
- # ・戦闘画面にXP風にバトラーを表示。
- # →Battlersフォルダに、
- # "アクターのフェイスグラフィック"+"_"+"フェイスインデックス"と
- # 同名のファイルをインポートしておく必要があります。
- # (例)
- # ファイスグラフィック名がface00、
- # フェイスインデックスが5の場合、
- # ファイル名は "face00_5" となります。
- #
- # □フェイスインデックスの割り当て図
- # 0123
- # 4567
- #
- # ・基準位置が画面のアニメーションの座標補整機能が実装されました。
- # ・アニメーションスピード調整機能追加。
- # ・従来のようにウィンドウ表示が可能に。
- #
- #------------------------------------------------------------------------------
- #
- # 更新履歴
- # ◇1.1f→1.2
- # バトラー座標の位置変更
- # ◇1.1→1.1f
- # フラッシュの処理を入れ忘れていたのを修正
- #
- #==============================================================================
- # ■ STRRGSS2(設定箇所)
- #==============================================================================
- module STRRGSS2
- # 基準位置が画面のアニメーションの座標修正 true = 有効 false = 無効
- BT_ANIME = true
- # 補整が有効な場合のY座標修正
- BT_ANIME_SY = 128
- # アニメスピード 1 以上の整数 (参考) 2で2倍速、4で標準速
- ANIME_SPEED = 4
-
- # アクターバックウィンドウを表示
- ABWINDOW = true
- # ウィンドウの方式 0 = ウィンドウスキン 1 = グラデーション
- ABW_TYPE = 1
- # ウィンドウ矩形
- ABW_RECT = Rect.new(0, 0, 544, 128)
- # ウィンドウの座標
- ABW_X = 0
- ABW_Y = 416 - 128
- # ウィンドウ幅
- ABW_W = 544
- ABW_H = 128
- # グラデーションのカラー [上,下]
- ABW_C = [Color.new(0,0,0,0), Color.new(0,0,0,160)]
- @a_back_sprite = Sprite.new(@viewport1)
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- # バトラーグラフィックを表示
- A_BATTLER = true # falseにすると画像を用意しなくても動作するようになります
- # バトラーX座標修正
- A_BATTLER_SX = -4
- # バトラー座標
- # Z座標
- SCREEN_Z = 120
- def set_b_xy(id)
- w = 544 / $game_party.members.size
- # X座標
- x = (544 / 2) - (($game_party.actors.size - 1) * (w / 2))
- m = $game_party.actors
- x += (m.index(id) * w) + A_BATTLER_SX
- @screen_x = x
- # Y座標
- @screen_y = 416 - 30
- end
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :screen_x # バトル画面 X 座標
- attr_accessor :screen_y # バトル画面 Y 座標
- #--------------------------------------------------------------------------
- # ● バトル画面 Z 座標の取得
- #--------------------------------------------------------------------------
- def screen_z
- set_b_xy(@actor_id)
- return SCREEN_Z
- end
- #--------------------------------------------------------------------------
- # ★ エイリアス
- #--------------------------------------------------------------------------
- alias setup_str11 setup
- def setup(actor_id)
- setup_str11(actor_id)
- @screen_x = 0
- @screen_y = 0
- @battler_name = @face_name + "_" + @face_index.to_s
- @battler_name = "" unless A_BATTLER
- end
- #--------------------------------------------------------------------------
- # ★ 再定義
- #--------------------------------------------------------------------------
- def use_sprite?
- return true # 使う
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● 新しいエフェクトの設定
- #--------------------------------------------------------------------------
- alias setup_new_effect_str11a setup_new_effect
- def setup_new_effect
- if @battler.white_flash
- @effect_type = WHITEN
- @effect_duration = 16
- @battler.white_flash = false
- end
- if @battler.animation_id != 0
- animation = $data_animations[@battler.animation_id]
- mirror = @battler.animation_mirror
- sy = @battler.animation_sy
- start_animation(animation, mirror, sy)
- @battler.animation_id = 0
- @battler.animation_sy = 0
- end
- setup_new_effect_str11a
- end
- end
- #==============================================================================
- # ■ Sprite_Base
- #==============================================================================
- class Sprite_Base < Sprite
- # 解像度
- DISPLAY_W = 544
- DISPLAY_H = 416
- #--------------------------------------------------------------------------
- # ★ 再定義の嵐
- #--------------------------------------------------------------------------
- def update
- super
- if @animation != nil
- @animation_duration -= 1
- if @animation_duration % STRRGSS2::ANIME_SPEED == 0
- update_animation
- end
- end
- @@animations.clear
- end
- alias start_animation_str11a start_animation
- def start_animation(animation, mirror = false, sy = 0)
- start_animation_str11a(animation, mirror)
- if @animation.position == 3
- if viewport == nil
- @animation_ox = DISPLAY_W / 2
- @animation_oy = (DISPLAY_H / 2) + sy
- else
- @animation_ox = viewport.rect.width / 2
- @animation_oy = (viewport.rect.height / 2) + sy
- end
- end
- @animation_duration = @animation.frame_max * STRRGSS2::ANIME_SPEED + 1
- end
- def update_animation
- if @animation_duration > 0
- frame_index = @animation.frame_max - (@animation_duration + (STRRGSS2::ANIME_SPEED-1)) / STRRGSS2::ANIME_SPEED
- animation_set_sprites(@animation.frames[frame_index])
- for timing in @animation.timings
- if timing.frame == frame_index
- animation_process_timing(timing)
- end
- end
- else
- dispose_animation
- end
- end
- def animation_process_timing(timing)
- timing.se.play
- case timing.flash_scope
- when 1
- self.flash(timing.flash_color, timing.flash_duration * STRRGSS2::ANIME_SPEED)
- when 2
- if viewport != nil
- viewport.flash(timing.flash_color, timing.flash_duration * STRRGSS2::ANIME_SPEED)
- end
- when 3
- self.flash(nil, timing.flash_duration * STRRGSS2::ANIME_SPEED)
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● アクタースプライトの作成
- #--------------------------------------------------------------------------
- def create_actors
- @actor_sprites = []
- for actor in $game_party.members.reverse
- @actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
- end
- # アクターバックウィンドウ
- if STRRGSS2::ABW_TYPE == 1
- @a_back_sprite = Sprite.new(@viewport1)
- c = STRRGSS2::ABW_C
- rect = STRRGSS2::ABW_RECT
- v = true
- bitmap = Bitmap.new(STRRGSS2::ABW_W, STRRGSS2::ABW_H)
- bitmap.gradient_fill_rect(rect, c[0], c[1], v)
- @a_back_sprite.bitmap = bitmap
- @a_back_sprite.x = STRRGSS2::ABW_X
- @a_back_sprite.y = STRRGSS2::ABW_Y
- else
- rect = STRRGSS2::ABW_RECT
- x = STRRGSS2::ABW_X + rect.x
- y = STRRGSS2::ABW_Y + rect.y
- @a_back_sprite = Window_Base.new(x, y, rect.width, rect.height)
- @a_back_sprite.viewport = @viewport1
- end
- @a_back_sprite.z = 110
- @a_back_sprite.visible = STRRGSS2::ABWINDOW
- end
- #--------------------------------------------------------------------------
- # ● アクタースプライトの更新
- #--------------------------------------------------------------------------
- def update_actors
- for sprite in @actor_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # ● アクタースプライトの解放
- #--------------------------------------------------------------------------
- def dispose_actors
- for sprite in @actor_sprites
- sprite.dispose
- end
- if STRRGSS2::ABW_TYPE == 1
- @a_back_sprite.bitmap.dispose
- end
- @a_back_sprite.dispose
- end
- end
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :animation_sy
- #--------------------------------------------------------------------------
- # ★ エイリアス
- #--------------------------------------------------------------------------
- alias clear_sprite_effects_str11a clear_sprite_effects
- def clear_sprite_effects
- clear_sprite_effects_str11a
- @animation_sy = 0
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :actors
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ★ 再定義
- #--------------------------------------------------------------------------
- def display_attack_animation(targets)
- if @active_battler.is_a?(Game_Enemy)
- #Sound.play_enemy_attack
- #wait(15, true)
- display_normal_animation(targets, 1)
- else
- aid1 = @active_battler.atk_animation_id
- aid2 = @active_battler.atk_animation_id2
- display_normal_animation(targets, aid1, false)
- display_normal_animation(targets, aid2, true)
- end
- wait_for_animation
- end
- #--------------------------------------------------------------------------
- # ● 通常アニメーションの表示
- # targets : 対象者の配列
- # animation_id : アニメーション ID
- # mirror : 左右反転
- #--------------------------------------------------------------------------
- def display_normal_animation(targets, animation_id, mirror = false)
- animation = $data_animations[animation_id]
- if animation != nil
- to_screen = (animation.position == 3) # 位置が「画面」か?
- for target in targets.uniq
- target.animation_id = animation_id
- target.animation_mirror = mirror
- if target.is_a?(Game_Actor) and to_screen and STRRGSS2::BT_ANIME
- target.animation_sy = STRRGSS2::BT_ANIME_SY
- end
- wait(20, true) unless to_screen # 単体用ならウェイト
- end
- wait(20, true) if to_screen # 全体用ならウェイト
- end
- end
- end
复制代码 |
|