MatchResult:getMiddleX()
一致した領域の中心点の X 座標を返します。
説明
getMiddleX() メソッドは、一致した領域の水平方向の中心位置(X 座標)を返します。一致した画像やテキストの中心をクリックするような操作を行いたい場合に便利です。
中心の X 座標は getX() + (getWidth() / 2) として計算されます。
シグネチャ
getMiddleX(): number
戻り値
number - 一致した領域の中心点の X 座標(ピクセル単位)。
例
local result = Screen:find("button.png")
if result then
local centerX = result:getMiddleX()
local centerY = result:getMiddleY()
-- 一致した位置の中心をクリック
Screen:click(centerX, centerY)
end