| 
 
| 赞 | 0 |  
| VIP | 13 |  
| 好人卡 | 29 |  
| 积分 | 1 |  
| 经验 | 6560 |  
| 最后登录 | 2013-11-8 |  
| 在线时间 | 112 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间112 小时注册时间2011-10-6帖子182 | 
3楼
 
 发表于 2012-4-20 19:59:53
手机端发表。
|
只看该作者 
| 本帖最后由 吉井明久 于 2012-4-20 21:02 编辑 
 本楼属于故意连贴,旨在分享另一种方法。
 插入后,行走图帧数将由文件名决定。@end55rpg复制代码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) % character_frame
      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) * (6 - @move_frequency)
      case @move_type
        when 1
          move_type_random
        when 2
          move_type_toward_player
        when 3
          move_type_custom
      end
    end
  end
  def character_frame
    @character_frame if @old_character_name == @character_name
    @character_frame = @character_name[/\[(\d*)f\]/] ? $1.to_i : 4
  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(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue)
        @cw = bitmap.width / @character.character_frame
        @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) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x 
    self.y = @character.screen_y
    self.z = @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(animation, true)
      @character.animation_id = 0
    end
  end
end
在文件名内加入 [6f] 代表六帧。
 文件名的任意位置都可以噢。
 
 如此就可以使用 更改角色图像 功能。
 | 
 |