I have many groups on the screen [1-30] and some buttons at the end of the screen.
Depending on button clicks alternations groups get removed and repositioned.
At the end 3 groups remains on the screen (it can be anyone from 1-30 depending on buttons click alternation).
Whatever group is clicked it gets removed from the screen and the other 2 repositioned again. On the last 2 ones (both remain on screen): whichever gets clicked gets resized smaller and the other one bigger.
For 3 remaining groups I call an addEventListener for each group, but it ends up removing all them on clicking over. I need to removeEventListener for 2 remaining groups when clicking first group from 3 left and then add another EventListener to each of them to resize.
I am having trouble solving this situation.
Keeps returning “Attempt to call method ‘removeEventListener’ (a nil value)”
Do you have any idea please?
How can I achieve this performance?
Here is some of my code:
local function 3groupsremaining(group1,group2,group3) return function(event) groupList[group1]:removeSelf() transition.to(groupList[group2], {time=1000, x=0, y=0}) transition.to(groupList[group3], {time=1000, x=50, y=0}) groupList[group2]:removeEventListener( "touch", 3groupsremaining(1,2,3)) groupList[group3]:removeEventListener( "touch", 3groupsremaining(1,2,3)) return true end end groupList[1]:addEventListener("touch", 3groupsremaining(1, 2, 3)) groupList[2]:addEventListener("touch", 3groupsremaining(2, 1, 3)) groupList[3]:addEventListener("touch", 3groupsremaining(3, 1, 2))
