Good day
I’m currently trying to do this:
I have 2 objects, One is static with a touch event, the other is hybrid with a touch event also
The plan is, hybrid object should be dragged on top of the static object. Also If I hover over static object I should detect a moved state on static object, same as ended or cancelled.
Right now I can’t figure out how can I solve this
Hybrid Object
-has return true
-has focus
Static Object
-has return true
Here is my code
For Static:
forHover = function(self,event) local phase = event.phase if phase == "began" then -- print("Test") elseif phase == "moved" then print("Static moved state detected") else if phase == "cancelled" then else --DO SOMETHING ON RELEASE end end return true end
For Hybrid:
dragOfItem = function(self,event) local phase = event.phase if phase == "began" then display.getCurrentStage():setFocus( self ) self.isFocus = true elseif phase == "moved" then -- print(self.coordinates) self.x = event.x self.y = event.y print("HYBRID IS MOVING") else if phase == "cancelled" then else --DO SOMETHING ON RELEASE OF HYBRID end display.getCurrentStage():setFocus( nil ) self.isFocus = false end return true end
Again, Static Object should detect moved state even if hybrid object is above it.
Thanks in advance.
