#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: # [Xp/Vx] Animated Picture # Version: 1.00 # Author : LiTTleDRAgo #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: # # Name your pictures with "anime_01-001","anime_01-002","anime_01-003" and so on # You can use more than 1 animated picture # # Just name it like "anime_02-001", "anime_02-002", etc # "anime_03-001", "anime_03-002", etc # #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: #============================================================================== # ** Game_Picture #------------------------------------------------------------------------------ # This class handles the picture. It's used within the Game_Screen class # ($game_screen). #============================================================================== class Game_Picture #-------------------------------------------------------------------------- # * Script Configuration #-------------------------------------------------------------------------- DELAY = 3 # delay after each image (frames) LAST_FRAME_VAR = 1 CURRENT_FRAME_VAR = 2 #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias update_animated_pict update #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update if @name =~ /anime_..-(\d+)/i @animated = true else @animated = false end if @animated @counter.nil? ? @counter = 0 : @counter += 1 if @counter == DELAY @counter = 0 if $game_variables[CURRENT_FRAME_VAR] < $game_variables[LAST_FRAME_VAR] $game_variables[CURRENT_FRAME_VAR] += 1 @frame = $game_variables[CURRENT_FRAME_VAR] @temp = @name.scan(/anime_../) case @frame when 0..9 then @frame = "00#{@frame}" when 10..99 then @frame = "0#{@frame}" end name = "#{@temp}-#{@frame}" @name = name if picture_exist?(name) end end end update_animated_pict end #-------------------------------------------------------------------------- # * Picture Exist #-------------------------------------------------------------------------- def picture_exist?(filename) if defined?(Window_ActorCommand) return Cache.picture(filename) rescue return false else return RPG::Cache.picture(filename) rescue return false end end end