123

123



function isPointInRectangle(x, y, rectX, rectY, rectW, rectH)

return x > rectX and y > rectY and x < rectX+rectW and y < rectY+rectH

end


function onTick()

inputX = input.getNumber(3)

inputY = input.getNumber(4)

isPressed = input.getBool(1)


isPressingRight = isPressed and isPointInRectangle(inputX, inputY, 192, 0, 96, 160)

isPressingLeft = isPressed and isPointInRectangle(inputX, inputY, 0, 0, 96, 160)


output.setBool(1, isPressingLeft)

output.setBool(2, isPressingRight)

end

Report Page