| 
 
| 赞 | 15 |  
| VIP | 320 |  
| 好人卡 | 64 |  
| 积分 | 3 |  
| 经验 | 112963 |  
| 最后登录 | 2022-8-25 |  
| 在线时间 | 2355 小时 |  
 Lv2.观梦者 (暗夜天使) 
	梦石0 星屑266 在线时间2355 小时注册时间2009-3-13帖子2309 
 | 
| 本帖最后由 Sion 于 2013-4-30 16:37 编辑 
 黑舞嗜 发表于 2013-4-29 20:08 ![]() 没法配合8方行走图的脚本啊...把def move_by_input 到下一个 end 还有它们之间的内容都删掉也不行啊 ...
 八方行走图补丁,鼠标八方移动补丁见29楼
 复制代码#===============================================================================
#  八方向行走
#    by:铅笔描绘的思念
#    在Characters里添加八方向行走图(命名规范:在四方向上的基础上+_8D)
#    行走动画就为8方向的。否则就会原4方向的代替8方向的。
#
#    八方向:数字键盘方向对应的数字
#     7   8   9
#      ↖ ↑ ↗
#     4← 0 →6
#      ↙ ↓ ↘
#     1   2   3
#
#  2013.4.30 Edited by me
#    
#    各种bug修正 + 各种效率优化
#    8d行走图需用.png格式
#
#    这个脚本可以独立正常工作
#    注意:同鼠标脚本配合使用,需要置于·八方移动补丁·上方!
#
#===============================================================================
class Game_Player
  def move_by_input
    return if !movable? || $game_map.interpreter.running?
    case Input.dir8
    when 2,4,6,8; move_straight(Input.dir8)
    when 1; move_diagonal(4, 2)
    when 3; move_diagonal(6, 2)
    when 7; move_diagonal(4, 8)
    when 9; move_diagonal(6, 8)
    end
  end
end
class Game_CharacterBase
  def move_diagonal(horz, vert)
    @move_succeed = diagonal_passable?(x, y, horz, vert)
    if @move_succeed
      @x = $game_map.round_x_with_direction(@x, horz)
      @y = $game_map.round_y_with_direction(@y, vert)
      @real_x = $game_map.x_with_direction(@x, reverse_dir(horz))
      @real_y = $game_map.y_with_direction(@y, reverse_dir(vert))
      increase_steps
    end
    if horz == 4
      vert == 2 ? set_direction(1) : set_direction(7)
    else
      vert == 2 ? set_direction(3) : set_direction(9)
    end
  end
end
class Sprite_Character < Sprite_Base
  def set_character_bitmap
    if File.exist?("Graphics/Characters/#{@character_name}_8D.png")
      @_8d = true
      bitmap1 = Cache.character(@character_name)
      bitmap2 = Cache.character(@character_name + "_8D")
      width = bitmap1.width
      height = bitmap1.height
      rect = Rect.new(0, 0, width, height)
      self.bitmap = Bitmap.new(width * 2, height * 2)
      self.bitmap.blt(0, 0, bitmap1, rect)
      self.bitmap.blt(width, 0, bitmap2, rect)
      sign = @character_name[/^[\!\$]./]
      if sign && sign.include?("$")
        @cw = width / 3
        @ch = height / 4
      else
        @cw = width / 12
        @ch = height / 8
      end
      self.ox = @cw / 2
      self.oy = @ch
    else
      self.bitmap = Cache.character(@character_name)
      sign = @character_name[/^[\!\$]./]
      if sign && sign.include?("$")
        @cw = bitmap.width / 3
        @ch = bitmap.height / 4
      else
        @cw = bitmap.width / 12
        @ch = bitmap.height / 8
      end
      self.ox = @cw / 2
      self.oy = @ch
    end
  end
  def update_src_rect
    return if @tile_id != 0
    index = @character.character_index
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    if @character.direction % 2 == 1
      sx += self.bitmap.width / 2 if @_8d
      row = case @character.direction
      when 1; 0
      when 3; 2
      when 7; 1
      when 9; 3
      end
      sy = (index / 4 * 4 + row) * @ch
    else
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    end
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end
 | 
 评分
查看全部评分
 |