Multi Frames
Автор: HopeBree
Версия: 1.0
Тип: Графика




Описание:
Этот скрипт позволяет использовать графику анимации персонажей или монстров любого количества кадров (отличной от 4).

Использование:
  1. Вставить скрипт между Scene_Debug и Main
  2. Добавить в название файла f_n, где n количество кадров в анимации.


PHP код:
###############################################################################
# [XP] Multi Frames                                                           #
# Версия: 1.0                                                                 #
# Автор: HopeBree                                                             #
# =========================================================================== #
# Описание:                                                                   #
#  Этот скрипт позволяет использовать графику анимации персонажей             #
#  или монстров любого количества кадров (отличной от 4).                     #
# =========================================================================== #
# Инструкция:                                                                 #
#  Добавить в название файла f_n, где n количество кадров в анимации.         #
# =========================================================================== #
# Например:                                                                   #
#  Fighter f_6.png                                                            #
# =========================================================================== #
# Установка:                                                                  #
#  Вставить скрипт между Scene_Debug и Main                                   #
###############################################################################

class Game_Actor Game_Battler
  def character_frames
    
@character_name.gsub(/f\_(\d+)/) do
      if $
!= @character_name
        
return $1.to_i
      end
    end
    
return 4
  end
end

class Sprite_Character RPG::Sprite
  def character_frames
    
@character_name.gsub(/f\_(\d+)/) do
      if $
!= @character_name
        
return $1.to_i
      end
    end
    
return 4
  end
end

class Game_Character
  def character_frames
    
@character_name.gsub(/f\_(\d+)/) do
      if $
!= @character_name
        
return $1.to_i
      end
    end
    
return 4
  end
end

class Game_Character
  def update
    
if jumping?
      
update_jump
    elsif moving
?
      
update_move
    
else
      
update_stop
    end
    
if @anime_count 18 - @move_speed 2
      
if not @step_anime and @stop_count 0
        
@pattern = @original_pattern
      
else
        @
pattern = (@pattern 1) % 
          (
self.is_a?(Game_Player) ? character_frames 4)
      
end
      
@anime_count 0
    end
    
if @wait_count 0
      
@wait_count -= 1
      
return
    
end
    
if @move_route_forcing
      move_type_custom
      
return
    
end
    
if @starting or lock?
      return
    
end
    
if @stop_count > (40 - @move_frequency 2) * (- @move_frequency)
      case @
move_type
      when 1
        move_type_random
      when 2
        move_type_toward_player
      when 3
        move_type_custom
      end
    end
  end
end

class Sprite_Character
  def update
    super
    
if @tile_id != @character.tile_id or
       @
character_name != @character.character_name or
       @
character_hue != @character.character_hue
      
@tile_id = @character.tile_id
      
@character_name = @character.character_name
      
@character_hue = @character.character_hue
      
if @tile_id >= 384
        self
.bitmap RPG::Cache.tile($game_map.tileset_name,
          @
tile_id, @character.character_hue)
        
self.src_rect.set(003232)
        
self.ox 16
        self
.oy 32
      
else
        
self.bitmap RPG::Cache.character(@character.character_name,
          @
character.character_hue)
        @
cw bitmap.width 
          (@
character.is_a?(Game_Player) ? character_frames4)
        @
ch bitmap.height 4
        self
.ox = @cw 2
        self
.oy = @ch
      end
    end
    self
.visible = (not @character.transparent)
    if @
tile_id == 0
      sx 
= @character.pattern * @cw
      sy 
= (@character.direction 2) / * @ch
      self
.src_rect.set(sxsy, @cw, @ch)
    
end
    self
.= @character.screen_x
    self
.= @character.screen_y
    self
.= @character.screen_z(@ch)
    
self.opacity = @character.opacity
    self
.blend_type = @character.blend_type
    self
.bush_depth = @character.bush_depth
    
if @character.animation_id != 0
      animation 
$data_animations[@character.animation_id]
      
animation(animationtrue)
      @
character.animation_id 0
    end
  end
end

class Window_Base Window
  def draw_actor_graphic
(actorxy)
    
bitmap RPG::Cache.character(actor.character_nameactor.character_hue)
      
cw bitmap.width actor.character_frames
      ch 
bitmap.height 4  
    src_rect 
Rect.new(00cwch)
    
self.contents.blt(cw 2chbitmapsrc_rect)
  
end
end