DragDrop with Touch issue

Just started using Construct 2? Post your questions here

Post » Fri Jul 24, 2015 2:49 pm

I'm making a card game that needs to work on both desktop and mobile, the desktop version works completely and on mobile I'm able to drag the cards around fine. However, when I try to drop a card on top of a another card, or stack of cards, it does not 'pick' the card as it does on the desktop.

I can't really post the capx b/c the project is under NDA, and it appears that imgur uploading is now blocked at work b/c I can't upload a screenshot of the chunk in question.

I have family 'Cards' containing the object 'Card'
Cards DragDrop is dragging
set gLastTouchX to Touch.X
set gLastTouchT to Touch.Y

Card -> on DragDrop drop
Card is overlapping Cards
system no is on mobile
Cards pick nearest to Mouse.X, Mouse.y (if card dropped over many, pick set closest to mouse for accuracy)
...rest of this works
else system is on mobile
Cards pick nearest to gLastTouchX, gLastTouchY
Debug(a text object in scene) set text to "dropped at: "&gLastTouchX (<-- this never happens)

on a mobile device, after I drop the card since it never does the pick nearest to. While the card is dragging I can see the vars lasttouchx and y updating since I have them update to a text object as well
I have a debug text object update with each condition down the tree, the touch drop gets all the way to the Pick: it knows it's overlapping Cards, it does the "system is on mobile" but the pick nearest finds nothing

any ideas?

edit: I think I figured the cause of the issue, that "pick nearest to (x,y) doesn't necessarily pick the top instance of the card, and adding pick top as a secondary condition doesn't work either because of the pick nearest already filtering down to 1 card.

I can't just use pick top because the potential for the card to overlap another nearby card that may technically be higher up in the z-stack. Is there any quick way to pick a selection of objects that are overlapping a specific x,y coordinate rather than "pick closest to" that only picks one?
Posts: 2
Reputation: 181

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests