I read the sample code that has come with corona and i need a little more help. What i want to do is when the user is touching a certain image and then touches say a platform, it does something like rotate it. So basically when one thing is touched and another thing is, it does something to the second thing touched. I know its not like the best detail, but any help is great. Thank you!! [import]uid: 38977 topic_id: 19953 reply_id: 319953[/import]
You’d enable multitouch first using;
[lua]system.activate( “multitouch” ) [/lua]
Let’s say you have two objects named “rotateBtn”, which is the button you need to know if they are touching or not - and “platform”.
You’d first do this;
[lua]local touchingRotate = false
local function touchRotate (event)
if event.phase == “began” then
touchingRotate = true
elseif event.phase == “ended” then
touchingRotate = false
end
end
rotateBtn:addEventListner(“touch”, touchRotate)[/lua]
Now you know whether or not it is being touched, so you’d add this to your platform;
[lua]local function touchPlatform ()
if touchingRotate == true then
– rotate here
end
end
platform:addEventListener(“touch”, touchPlatform)[/lua]
No guarantees that is typo free but should give you a solid start.
Peach
[import]uid: 52491 topic_id: 19953 reply_id: 77708[/import]