How to set a specific part of the screen touch enabled?

Hello all! i want to set a specific part of the screen touch enabled. You see, my game relies on a specific part to be touch enabled, and not the other. Im not advanced on coding, nor had any prior knowledge on the topic. I have came so far, so hopefully i can finish my game. If you can provide a sample coding, i would love it. 

There are several approaches.  You can make the whole screen touchable but in the touch handler, throw away touches that are not in areas that you want.

You can add touch handlers to individual objects like a button, where only the object is touchable.

If you want just an area to be touchable, and not restricted to a small area like a button you can add an invisible rectangle.  You can do something like:

local bottomLeftTouchZone = display.newRect(0, 0, display.contentWidth / 2, display.contentHeight / 2) bottomLeftTouchZone.isHitTestable = true bottomLeftTouchZone.isVisible = false bottomLeftTouchZone:addEventListener( "touch", someFunctionToHandleTheTouch) bottomLeftTouchZone.anchorX = 0 bottomLeftTouchZone.anchorY = 1 bottomLeftTouchZone.x = 0 bottomLeftTouchZone.y = display.contentHeight

There are several approaches.  You can make the whole screen touchable but in the touch handler, throw away touches that are not in areas that you want.

You can add touch handlers to individual objects like a button, where only the object is touchable.

If you want just an area to be touchable, and not restricted to a small area like a button you can add an invisible rectangle.  You can do something like:

local bottomLeftTouchZone = display.newRect(0, 0, display.contentWidth / 2, display.contentHeight / 2) bottomLeftTouchZone.isHitTestable = true bottomLeftTouchZone.isVisible = false bottomLeftTouchZone:addEventListener( "touch", someFunctionToHandleTheTouch) bottomLeftTouchZone.anchorX = 0 bottomLeftTouchZone.anchorY = 1 bottomLeftTouchZone.x = 0 bottomLeftTouchZone.y = display.contentHeight