[RESOLVED]Animated Picture

Started by kreiss, May 29, 2018, 09:20:41 am

Previous topic - Next topic

kreiss

May 29, 2018, 09:20:41 am Last Edit: May 29, 2018, 03:03:49 pm by kreiss
Hi guys!

I finded a script in Littledrago's blog.
But I don't know how the script work.

I rename my picture by "anime_01-001", "anime_01-002" etc...
But isn't working.

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# [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


Sorry for disturbance.

Edit : Isn't the good section, someone can move the topic please ?

KK20

Are you using game variables 1 and 2 for anything?





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

kreiss

May 29, 2018, 12:12:36 pm #2 Last Edit: May 29, 2018, 12:15:28 pm by kreiss
No, I use a new project.

Edit: Ow...  :facepalm:
I had to use a variable to move pictures.

It was so simple. :facepalm:

Thanks to help !