i would like to create some kinda of blocks game
Each block is a widget button.
The game mechanism is to tap on one block and drag horizontally or vertically to select multiple blocks.
And release to clear them out.
Here is my code
local function onBlockEvent(event) local phase = event.phase local target = event.target if phase == 'began' then print( "You pressed a button!" ) end if phase == 'moved' then -- print( "You pressed and moved a button!" ) end if phase == 'ended' then print( "You pressed and released a button!" ) end if phase == 'cancelled' then print('You cancelled the button click but dragged') end end local block = widget.newButton { width = confs.w, height = confs.h, defaultFile = imgFile, font = confs.font, fontSize = confs.fontSize, label = number, labelColor = confs.labelColor, onEvent = onBlockEvent, } block:setReferencePoint(display.CenterReferencePoint) block.x, block.y = params.x, params.y
But i have a difficulty because when i touch-drag the first block, the second block will never be selected…
what is the trick to perform the multiple button widget to be selected?
Thanks for your input.
Regards,
Weilies