Project1

标题: 关于‘桜雅’的即时横版战斗系统(full-move battle system) [打印本页]

作者: j296196585    时间: 2017-8-11 02:59
标题: 关于‘桜雅’的即时横版战斗系统(full-move battle system)
本帖最后由 j296196585 于 2017-8-11 03:00 编辑

我用‘桜雅’的即时横版战斗系统时发现这个范本是以三名同伴为基础设定的,因此战斗时的坐标也是按3个人物定的吧?我设定了四个人物,如果一起出战的话胜利退出后,在遇到第2次战斗时就会显示脚本'fullcbs part-11'的第88行错误:undefined method`-'for nil:NilClass,进脚本后发现88行(红色字)所在的部分如下:
#--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得
  #--------------------------------------------------------------------------
  def screen_x
    # パーティ内の並び順から X 座標を計算して返す
    if self.index != nil
      if @actor_in_battlefield
        $xcam_x = 0 if $xcam_x == nil
        return 96 + 32 - @field_x_offset + (@x_pos - $xcam_x) * @zoom   
      else
        return self.index * 160 + 80
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Y 座標の取得
  #--------------------------------------------------------------------------
  def screen_y
    if @actor_in_battlefield
      $xcam_y = 0 if $xcam_y == nil
return 96 + 32 - @field_x_offset + (@x_pos - $xcam_x) * @zoom  

    else
      return 464
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Z 座標の取得
  #--------------------------------------------------------------------------
  def screen_z
    index = $game_party.actors.reverse.index(self)
    return @z_pos + (index == nil ? 0 : index)
  end
end


请问该改成多少才能使4个同伴战斗时不会再出错呢?
作者: cinderelmini    时间: 2017-8-21 19:40
怎么总觉得得把x改成y………………
比如这样。。。
  1. return 96 + 32 - @field_y_offset + (@y_pos - $xcam_y) * @zoom
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1