Different Events On Multiple Button Touches

I am trying to get different things to happen on different numbered touches ( if that makes any sense ) so if I touch the button once it will remove an image, and if I touch it again ( second time ) it would call a function. I've been trying different ways but after the image is removed I keep getting an error, that the image is nil, cause it is already removed. Thanks

Posting some code would help. It's hard from your description to figure out what you are trying to accomplish.

-David

I am creating a dinosaur game for kids. In one section of the app, they can dig up dinosaur bones. I have 6 pictures all with different alpha masks to expose more bones as you dig. I have a shovel button with a removeSelf event for the images every time the button is tapped until it gets to the last image then it wont remove anymore images ( xxxfanta help me with that one )

1
2
3
4
5
6
7
8
--
local function removeImage( event )
 if ( digGroup.numChildren > 1 ) then
      digGroup[ digGroup.numChildren ]:removeSelf()
  end
end
 
shovel:addEventListener( "tap", removeImage )

I would consider not deleting the object, but rather have the object displayed as a sprite that is indexed with each scoop of a shovel. You could had the image represented as 2.5D image.

Might be easier and address an issue if the player only digs part way and moves on to another location.

-David

views:1491 update:2011/12/1 20:56:45
corona forums © 2003-2011