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.
Comments
Likes: intellipro21
"Gem touched i= 6 j= 6" (
Likes: intellipro21
http://www.iprospl.com/
http://www.iprospl.com/
Hope it helps.
Likes: intellipro21
I assumed that all other events would be removed and only this one used
still it is a good practice to stop propagation, once you found your target
Likes: intellipro21
Am i doing something wrong in hitTestPoint part?
I also checked the "gemsTable" values and it contains all other values not only i=6 and j=6.
http://www.iprospl.com/
Thank you so much guys @ar2rsawseen,, @Esc ,,you are life saver..
=D> :-bd
http://www.iprospl.com/
16,25,41,121
Is this what you expected to happen?
(i haven't edit it completely)
For me, i always use one mouse event/touch event, and use table to seek object.
(And on line 25, i usually use function that attached to the object, for example newGem:touchUp(event) )
It have less bug to do things like that.
Edit: Late to see the last message while editting, lol. \m/ \m/ \m/
Likes: intellipro21
Oh great! so at the time of creation of any new item/object/sprite , I should insert it in the touchHolder table , right? ,, wow,, that's thoughtful,, I could have never thought of that.. ha ha.,. ^:)^
http://www.iprospl.com/
1. Easily disable multitouch on the same table holder.
2. Setting up priority (for menu and such), with another table holder (gamescene.priorityTouchHolder or something).
3. Disable all touch holder, and enable just one holder, for example used when pop up menu appear.
But when removing, you need to search index, and remove it by index :
Likes: intellipro21
http://www.iprospl.com/