Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Issue with event listeners for multiple sprites using array of sprites — Gideros Forum

Issue with event listeners for multiple sprites using array of sprites

intellipro21intellipro21 Member
edited December 2014 in Code snippets
Hello, We are basically android application developer but we are planning to make simple 2d game for kids, so after some R&D we settled on Gideros and I am currently learning LUA and making simple games using available templates.

Currently I am facing a problem which I am not able to resolve, :(
If you can download the attached file and check what's wrong, I would be really very grateful,

I am just learning and trying to make a demo for fruit crush for learning purpose only. ( I grabbed some code from net)

1) I am not sure how to implement the touch listeners but I can successfully add touch to single sprites, but if they are generated randomly using a loop and array then I think I am doing something wrong. :( :(
for i = 1, 6, 1 do
    	gemsTable[i] = {}
		for j = 1, 6, 1 do
			gemsTable[i][j] = self:newGem(i,j,true)
			--*****if i declare touch events here it works but causes problems after some time, uncomment below and check yourself to know.******
			--[[gemsTable[i][j]:addEventListener(Event.MOUSE_UP, function (event)
												self:onGemTouch(gemsTable[i][j],event)
											end)]]
 		end
 
 	end

2) Another problem I am facing is with Gtween.

--********Another problem is with Gtween, if i change the position using this then its not working properly but if I directly change the postion then it works.
--GTween.new(newGem, 0.5, {y = newGem.destination_y}, {ease = easing.inOutCircular})

Please help me with this as I am stuck here from last few days.

Thanks in advance.

P.S. We are not planning to make a game like this , this is just for learning purpose as I am working on some different kind of game.
zip
zip
fruit crush.zip
47K

Comments

Sign In or Register to comment.