0

Hy all, i'm develope 1 little game both for android and iOS in Corona.

I need to set a mask to an image when users touch the group. Here is my code:

   local function eat( event )
      if event.phase == "began" the

        local mask = graphics.newMask( "file/mask.png" )
        local playSound = audio.play( biteSound )

        onDishGroup:setMask( mask )
        onDishGroup.maskX= event.x
        onDishGroup.maskY = event.y

    return true
end

The question is, how can i add multiple mask to that group ? Its work well, but this will set only 1 mask at a time, the old will remove or it will be just moving to the new x y.

Arnold
  • 273
  • 1
  • 11

1 Answers1

1

You cannot add multiple masks like that...

But you can put several groups one inside the other and add mask to them... Yes it is a ugly hack but...

speeder
  • 6,197
  • 5
  • 34
  • 51
  • thx, btw dosn't work whit my code... pls check where i'm wrong – Arnold Oct 05 '12 at 06:23
  • When i make a display group as an array and after onTouch i add the previous group to the new 1, after touche event the 1st bakcground will die. is realy when i add an object to 2 more displaygroup that will die ? – Arnold Oct 05 '12 at 06:54