hi, i’m new to corona.
I have 2 spritesheets. first sprite sheet is running continuously,and i want that whenever i’ll click on that running sprite-sheet,it will o play another sprite sheet.
is it possible using Lua? i know how to create this one in flash, but I dnt know anything abt click events in lua.
how can we do it using Lua for making ipad apps?
Thanks,
Regards,
Pravin G.
[import]uid: 52727 topic_id: 8933 reply_id: 308933[/import]
Here is an example of how to set up a touch event listener:
[blockcode]
local onTouch = function( self, event )
if event.phase == “began” then
– This block called:
– When a touch begins
elseif event.phase == “moved” then
– This block called:
– When the finger is dragged
elseif event.phase == “cancelled” then
– This block called:
– When the finger is no longer touching object
– but was not lifted from the object (dragged away from?)
elseif event.phase == “ended” then
– This block called:
– When the finger is lifted from the object
end
end
local myObject = … --> set up from spritesheet, etc.
– Assign the listener function above to “touch” events on myObject
myObject.touch = onTouch
myObject:addEventListener( “touch”, myObject )
[/blockcode]
As for getting spritesheet objects to play, etc. here is the reference page for spritesheets:
http://developer.anscamobile.com/reference/sprite-sheets
You can take the touch listener code I gave you, and put in the proper spritesheet code (play(), etc.) in the proper block depending on the requirements of your app.
Hope that helps! [import]uid: 52430 topic_id: 8933 reply_id: 32673[/import]