# ▼▲▼ No80. VXPフキダシ! ▼▲▼ # # update 2007/12/13 # #============================================================================== # カスタマイズポイント #============================================================================== module NO80 # フキダシアニメ速度(小さいほど速い) SPEED = 6 # フキダシファイル名(Windowskins) NAME= "Balloon" # キャラの立ち位置からフキダシ表示位置の高さ差 H = 48 # フキダシ最終フレームのウェイト時間 BALLOON_WAIT = 12 end #============================================================================== # ◆フキダシアイコンの表示 命令 #============================================================================== module VX def self.balloon(event_id, balloon_id = 1) case event_id when -1 event = $game_player when 0 id = $game_system.map_interpreter.event_id if id != 0 event = $game_map.events[id] end return if event.nil? else event = $game_map.events[event_id] end n = balloon_id n = 1 if n <= 0 if event != nil event.balloon_id = n end end end #============================================================================== # アクティブイベント取得機能 #============================================================================== class Interpreter attr_reader :event_id end #============================================================================== # フキダシ表示命令 #============================================================================== class Game_Character attr_accessor :balloon_id # フキダシアイコン ID end #============================================================================== # VXPフキダシ機能 #============================================================================== module VXP_Balloon #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(viewport) super(viewport) @balloon_duration = 0 @balloon_id = 0 if @character != nil update end end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose dispose_balloon super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_balloon if @character.balloon_id.to_i != 0 @balloon_id = @character.balloon_id start_balloon @character.balloon_id = 0 end end #-------------------------------------------------------------------------- # ● フキダシアイコン表示の開始 #-------------------------------------------------------------------------- def start_balloon dispose_balloon @balloon_duration = 8 * NO80::SPEED + NO80::BALLOON_WAIT @balloon_sprite = ::Sprite.new(viewport) @balloon_sprite.bitmap = RPG::Cache.windowskin(NO80::NAME) @balloon_sprite.ox = 16 @balloon_sprite.oy = 32 update_balloon end #-------------------------------------------------------------------------- # ● フキダシアイコンの更新 #-------------------------------------------------------------------------- def update_balloon if @balloon_duration > 0 @balloon_duration -= 1 if @balloon_duration == 0 dispose_balloon else @balloon_sprite.x = self.x @balloon_sprite.y = self.y - NO80::H @balloon_sprite.z = self.z + 200 if @balloon_duration < NO80::BALLOON_WAIT sx = 7 * 32 else sx = (7 - (@balloon_duration - NO80::BALLOON_WAIT) / NO80::SPEED) * 32 end sy = (@balloon_id - 1) * 32 @balloon_sprite.src_rect.set(sx, sy, 32, 32) end end end #-------------------------------------------------------------------------- # ● フキダシアイコンの解放 #-------------------------------------------------------------------------- def dispose_balloon if @balloon_sprite != nil @balloon_sprite.dispose @balloon_sprite = nil end end end class Sprite_Character < RPG::Sprite include VXP_Balloon end