if @tp_yq[1,1] + @tp_yq[1,2] + @tp_yq[1,3] == 3 or
@tp_yq[2,1] + @tp_yq[2,2] + @tp_yq[2,3] == 3 or
@tp_yq[3,1] + @tp_yq[3,2] + @tp_yq[3,3] == 3 or
@tp_yq[1,1] + @tp_yq[2,1] + @tp_yq[3,1] == 3 or
@tp_yq[1,2] + @tp_yq[2,2] + @tp_yq[3,2] == 3 or
@tp_yq[1,3] + @tp_yq[2,3] + @tp_yq[3,3] == 3 or
@tp_yq[1,1] + @tp_yq[2,2] + @tp_yq[3,3] == 3 or
@tp_yq[1,3] + @tp_yq[2,2] + @tp_yq[3,1] == 3 then
$judge = 1
end
if @tp_cc[1,1] + @tp_cc[1,2] + @tp_cc[1,3] == 6 or
@tp_cc[2,1] + @tp_cc[2,2] + @tp_cc[2,3] == 6 or
@tp_cc[3,1] + @tp_cc[3,2] + @tp_cc[3,3] == 6 or
@tp_cc[1,1] + @tp_cc[2,1] + @tp_cc[3,1] == 6 or
@tp_cc[1,2] + @tp_cc[2,2] + @tp_cc[3,2] == 6 or
@tp_cc[1,3] + @tp_cc[2,3] + @tp_cc[3,3] == 6 or
@tp_cc[1,1] + @tp_cc[2,2] + @tp_cc[3,3] == 6 or
@tp_cc[1,3] + @tp_cc[2,2] + @tp_cc[3,1] == 6 then
$judge = 2
end
end
现在就是写主刷新的时候
分为两个部分,一个是我方的刷新,一个是电脑的刷新
我方刷新部分
IF 按下鼠标左键 THEN
IF 在棋盘区域 THEN
获得鼠标的位置,这里不仅是坐标,而且要找出在二维数组中
的位置
IF 位置没有下过 THEN
显示棋子
在所在的二维数组中赋值
敌方除了要自己写AI算出要走的位置,其他的一样
脚本如下
case $game_phase
when 1
if Input.trigger?(Input::C) then
if in_area? then
course_x,course_y = judge_course_positon
if @tp_yq[course_x,course_y] != 1 and @tp_cc[course_x,course_y] != 2 then
@spriteset_jzq.require_position(1, ((course_y - 1) * 3 + course_x))
@tp_yq[course_x,course_y] = 1
$game_phase = 2
end
end
end
when 2
course_x,course_y = make_action
@spriteset_jzq.require_position(2, ((course_y - 1) * 3 + course_x))
@tp_cc[course_x,course_y] = 2
$game_phase = 1
end