#============================================================================== # ■ RGSS3 タイルアニメーション Ver1.01 by 星潟 #------------------------------------------------------------------------------ # 水場タイルのようにアニメーションするタイルを設定します。 #============================================================================== # マップのメモ欄で設定。 #------------------------------------------------------------------------------ # <タイルアニメ:[56,15],[57,30],[58,15],[59,30]> # # この場合、このマップ内において # 最初からタイルID56が設置されている座標全てが # タイルアニメを行う座標として設定されます。 # # タイルID56のタイルが15フレーム、タイルID57のタイルが30フレーム、 # タイルID58のタイルが15フレーム、タイルID59のタイルが30フレーム表示され # またタイルID56に戻り繰り返します。 #============================================================================== # イベントコマンドのスクリプトで設定。 # 最初の数字がX座標、次がY座標、次が下層〜上層の指定(0〜2) #------------------------------------------------------------------------------ # set_another_animation_tile(20,10,0, # [1552,30],[1553,30]) # # この場合、X座標20、Y座標10の下層タイルが # タイルアニメを行う座標として設定されます。 # # タイルID1552のタイルが30フレーム、 # タイルID1553のタイルが30フレーム表示され # またタイルID1552に戻り繰り返します。 #------------------------------------------------------------------------------ # set_another_animation_tile(10,5,1, # [56,25],[57,40],[58,35],[59,50]) # # この場合、X座標10、Y座標5の中層タイルが # タイルアニメを行う座標として設定されます。 # # タイルID56のタイルが25フレーム、タイルID57のタイルが40フレーム、 # タイルID58のタイルが35フレーム、タイルID59のタイルが50フレーム表示され # またタイルID56に戻り繰り返します。 #------------------------------------------------------------------------------ # set_another_animation_tile(15,3,2, # [56,15],[57,30],[58,15],[59,30]) # # この場合、X座標15、Y座標3の上層タイルが # タイルアニメを行う座標として設定されます。 # # タイルID56のタイルが15フレーム、タイルID57のタイルが30フレーム、 # タイルID58のタイルが15フレーム、タイルID59のタイルが30フレーム表示され # またタイルID56に戻り繰り返します。 #------------------------------------------------------------------------------ # delete_another_animation_tile(20,5) # # この場合、X座標20、Y座標5の全タイルのアニメ設定を削除します。 #------------------------------------------------------------------------------ # delete_another_animation_tile(20,5,0) # # この場合、X座標20、Y座標5の下層(床等)のタイルのアニメ設定を削除します。 #------------------------------------------------------------------------------ # delete_another_animation_tile(20,5,1) # # この場合、X座標20、Y座標5の中央(染み等)のタイルのアニメ設定を削除します。 #------------------------------------------------------------------------------ # delete_another_animation_tile(20,5,2) # # この場合、X座標20、Y座標5の上層(B〜Eタイル)のタイルのアニメ設定を削除します。 #============================================================================== module AnotherTileAnimation #空のハッシュを3つ用意。 Loop = {} TSet = {} TSetTrue = {} #タイルアニメの設定用キーワードを指定。 Word = "タイルアニメ" end class Game_Interpreter #-------------------------------------------------------------------------- # 指定座標のタイルアニメ情報セット #-------------------------------------------------------------------------- def set_another_animation_tile(x,y,i,*tile_data) h = { :tile_data => tile_data, :index_over => tile_data.size} $game_map.set_another_animation_tile(x,y,i,h) end #-------------------------------------------------------------------------- # 指定座標のタイルアニメ情報削除 #-------------------------------------------------------------------------- def delete_another_animation_tile(x,y,i = nil) $game_map.delete_another_animation_tile(x,y,i) end end class Game_Map #-------------------------------------------------------------------------- # セットアップ #-------------------------------------------------------------------------- alias setup_another_animation_tile setup def setup(map_id) @another_animation_tile_data = {0 => {},1 => {},2 => {}} setup_another_animation_tile(map_id) keys1 = @map.another_animation_tile_data.keys tsh = AnotherTileAnimation::TSetTrue[@map.tileset_id] keys2 = tsh ? tsh.keys : [] $game_map.width.times {|x| $game_map.height.times {|y| 3.times {|i| tile_id = $game_map.data[x,y,i] if keys1.include?($game_map.data[x,y,i]) h = @map.another_animation_tile_data[tile_id] set_another_animation_tile(x,y,i,h) elsif keys2.include?($game_map.data[x,y,i]) h = tsh[tile_id] set_another_animation_tile(x,y,i,h) end}}} end #-------------------------------------------------------------------------- # 指定座標のタイルアニメ情報セット #-------------------------------------------------------------------------- def set_another_animation_tile(x,y,i,hash) @another_animation_tile_data[i][[x,y]] = {:tile_data => hash[:tile_data], :index_over => hash[:index_over], :count_data => 0, :index => 0} end #-------------------------------------------------------------------------- # 指定座標のタイルアニメ情報削除 #-------------------------------------------------------------------------- def delete_another_animation_tile(x,y,i1 = nil) if i1 @another_animation_tile_data[i1].delete([x,y]) else 3.times {|i2| @another_animation_tile_data[i2].delete([x,y])} end end #-------------------------------------------------------------------------- # 遠景の更新 #-------------------------------------------------------------------------- alias update_parallax_another_animation_tile update_parallax def update_parallax update_parallax_another_animation_tile 3.times {|i| @another_animation_tile_data[i].each {|k,v| v[:count_data] += 1 if v[:count_data] >= v[:tile_data][v[:index]][1] v[:count_data] = 0 v[:index] += 1 v[:index] = 0 if v[:index] >= v[:index_over] $game_map.data[k[0],k[1],i] = v[:tile_data][v[:index]][0] end }} end end class RPG::Map #-------------------------------------------------------------------------- # マップ内タイルアニメ #-------------------------------------------------------------------------- def another_animation_tile_data @another_animation_tile_data ||= create_another_animation_tile_data end #-------------------------------------------------------------------------- # マップ内タイルアニメ情報作成 #-------------------------------------------------------------------------- def create_another_animation_tile_data h = {} note.each_line {|l| if /<#{AnotherTileAnimation::Word}[::](\S+)>/ =~ l a1 = eval(sprintf("[%s]",$1)) if a1.size > 1 h[a1[0][0]] = { :tile_data => a1, :index_over => a1.size} end end} h end end