=begin ●任意の変数をタイマー的に表示する ver1.0----------------------(c)光の軌想曲  指定した変数の名前と値を、タイマーと同じ要領で画面右上に  表示させ続けることができます。  ○つかいかた  ゲーム変数[SPR_VER_ID]の値を、表示させたい変数のIDにしておきます。  スイッチ[SPR_SWITCH_ID]がオンの間、その変数の名前と値が表示されます。 ○競合の可能性:ほとんどないと思われます         Spriteset_Map,Spriteset_Battleをエイリアス。 ○更新履歴 2010/ 4/18 ver1.0公開 =end #---------------------------------------------------------------------------- # ↓カスタマイズポイント module MAZ # ・表示オン/オフを切り替えるスイッチID SPR_SWITCH_ID = 49 # ・表示する変数のIDを指定する変数ID SPR_VAR_ID = 18 # ・使用するフォント名 #   使いたいフォントから順に並べてください。 # (参考)Arialはタイマーと同じフォントですが、日本語が文字化けするので注意 SPR_FONT = ["UmePlus Gothic", "Arial"] # ・文字のサイズ SPR_SIZE = 32 # ・文字の色 R,G,Bの順に設定 S_R = 255 S_G = 255 S_B = 255 # ・文字の不透明度 S_A = 255 end # ↑カスタマイズポイントおわり #------------------------------------------------------------------------------ #============================================================================== # ■ Sprite_Variable #------------------------------------------------------------------------------ #  変数表示用のスプライトです。$game_system を監視し、スプライトの状態を # 自動的に変化させます。 #============================================================================== class Sprite_Variable < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # viewport : ビューポート #-------------------------------------------------------------------------- def initialize(viewport) super(viewport) self.bitmap = Bitmap.new(320, 48) self.bitmap.font.name = MAZ::SPR_FONT self.bitmap.font.size = MAZ::SPR_SIZE self.x = 544 - self.bitmap.width - 4 self.y = 0 self.z = 200 update end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super if $game_system.timer_working # タイマーと重ならないよう避ける self.y = 36 else self.y = 0 end self.visible = $game_switches[MAZ::SPR_SWITCH_ID] if $game_variables[$game_variables[MAZ::SPR_VAR_ID]] != @value self.bitmap.clear id = $game_variables[MAZ::SPR_VAR_ID] @name = $data_system.variables[id] @value = $game_variables[id] @name = "" if @name == nil text = sprintf("%s %d", @name, @value) self.bitmap.font.color.set(MAZ::S_R, MAZ::S_G, MAZ::S_B, MAZ::S_A) self.bitmap.draw_text(self.bitmap.rect, text, 2) end end end #============================================================================== # ■ Spriteset_Map #------------------------------------------------------------------------------ #  マップ画面のスプライトやタイルマップなどをまとめたクラスです。このクラスは # Scene_Map クラスの内部で使用されます。 #============================================================================== class Spriteset_Map #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias val_initialize initialize def initialize val_initialize create_variable update end #-------------------------------------------------------------------------- # ● 変数表示スプライトの作成 #-------------------------------------------------------------------------- def create_variable @variable_sprite = Sprite_Variable.new(@viewport2) end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- alias var_dispose dispose def dispose dispose_variable var_dispose end #-------------------------------------------------------------------------- # ● 変数スプライトの解放 #-------------------------------------------------------------------------- def dispose_variable @variable_sprite.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias var_update update def update update_variable var_update end #-------------------------------------------------------------------------- # ● 変数スプライトの更新 #-------------------------------------------------------------------------- def update_variable @variable_sprite.update if @variable_sprite != nil end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias var_initialize initialize def initialize var_initialize create_variable update end #-------------------------------------------------------------------------- # ● 変数スプライトの作成 #-------------------------------------------------------------------------- def create_variable @variable_sprite = Sprite_Variable.new(@viewport2) end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- alias var_dispose dispose def dispose dispose_variable var_dispose end #-------------------------------------------------------------------------- # ● 変数スプライトの解放 #-------------------------------------------------------------------------- def dispose_variable @variable_sprite.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias var_update update def update update_variable var_update end #-------------------------------------------------------------------------- # ● 変数スプライトの更新 #-------------------------------------------------------------------------- def update_variable @variable_sprite.update if @variable_sprite != nil end end