【pyxel】図形の中をクリックしたかを判定する
これだけ!
四角い枠の中が押されたかどうかを判定します。
中身はこれだけ!
def is_click_inside_rect(self, x, y, w, h):
"""
四角形の中をクリックしたかどうか判定する
"""
if pyxel.btnp(pyxel.MOUSE_BUTTON_LEFT):
if (
x <= pyxel.mouse_x < x+w
and y <= pyxel.mouse_y < y+h
):
return True
return False