メインコンテンツまでスキップ

MatchResult:getMiddleY()

一致した領域の中心点の Y 座標を返します。

説明

getMiddleY() メソッドは、一致した領域の垂直方向の中心位置(Y 座標)を返します。一致した画像やテキストの中心をクリックするような操作を行いたい場合に便利です。

中心の Y 座標は getY() + (getHeight() / 2) として計算されます。

シグネチャ

getMiddleY(): number

戻り値

number - 一致した領域の中心点の Y 座標(ピクセル単位)。

local result = Screen:find("button.png")
if result then
local centerX = result:getMiddleX()
local centerY = result:getMiddleY()
-- 一致した位置の中心をクリック
Screen:click(centerX, centerY)
end