having blocks spawn on touch position but having onscreen buttons

Hey guys in my game I have it so where you touch it will spawn a block(square) but I have on screen buttons to move the player so when I press the button to move the player it moves but it also spawns a block . Would I use a scene group if so where is the documentation?

local physics = require("physics") physics.start() local bg = display.newRect(230,10,600,600) bg:setFillColor(0,1,1) local ground = display.newRect(230,300,600,100) ground:setFillColor(0,1,0) physics.addBody(ground,"static") local function build (event) local block1 = display.newRect(event.x,event.y,20,20) block1:setFillColor(165,42,42) physics.addBody(block1,"dynamic") end bg:addEventListener("tap",build) local player = display.newRect(100,200,20,20) physics.addBody(player,"dynamic") player:setFillColor(1,0,0) local btnR = display.newRect(90,290,50,30) local btnL = display.newRect(10,290,50,30) local function moveL (event) player.x = player.x - 20 end btnL:addEventListener("touch",moveL)

Make sure that your button tap handlers return true. This will stop the touch event passing down to the background.

Make sure that your button tap handlers return true. This will stop the touch event passing down to the background.