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()

isPressed = input.getBool(1)

nputX = input.getNumber(3)

inputY = input.getNumber(4)

temp = input.getNumber(5)





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

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

isPressingUp = isPressed and isPointInRectangle(inputX, inputY, 0, 0, 288, 50)

isPressingDown = isPressed and isPointInRectangle(inputX, inputY, 0, 110, 288, 50)




output.setBool(1, isPressingLeft)

output.setBool(2, isPressingRight)

output.setBool(3, isPressingUp)

output.setBool(4, isPressingDown)

end

Report Page