0

I am quite new to Corona SDK and could use some help. I am creating a connect the dots game and am running into a problem with re-setting focus.

Each dot has an onTouch event:

function onTouch(self, event)
  if event.phase == "began" then
    display.getCurrentStage():setFocus( self )
    table.insert( selectedDots, self )
    self.isSelected = true
  elseif event.phase == "moved" then
    display.getCurrentStage():setFocus( self )
    if self.Selected == false then
      table.insert( selectedDots, self )
      self.Selected = true
    end
  elseif event.phase == "ended" or event.phase == "cancelled"  then
    --remove dots
  end
end

Basically, I want players to press a dot and hold and any other dots they touch while holding are "selected." I had everything working, until I realized that unless players ended their touch on a dot, the ended phase would not trigger.

Any help/advice would be greatly appreciated. I'm stuck!

greatwolf
  • 20,287
  • 13
  • 71
  • 105
jon
  • 170
  • 1
  • 13

1 Answers1

2

Just pass the moved var though the function like this:

onTouch({phase="moved"})

Hope this helps

Jordan Schuetz
  • 1,036
  • 1
  • 10
  • 19