I’ve got is a 7x7 grid of tiles. Then a larger tile below that, which is the current tile the player’s got to work with. The idea is the user drags that larger tile onto the grid and drops it on a space. When they begin the drag from the larger tile, a smaller tile is copied from the larger one, and the smaller one is actually dragged onto the grid.
I am trying to make these grid tiles and the dragging tile sensors and then use collision detection to determine which tile in the grid the dragging tile is contacting. If it is touching more than 1, it figures which grid tile is being overlapped more, to determine the final dropped location.
Could this physics problem be related to the use of the physics shapes, or the physics object being part of a displayGroup? I had to use the physics shape that because these tile images are scaled down, and the physics didn’t appear to be working with the scaled size of the images. The physics engine was using the original image size. The reason I’m scaling the images is that I may want a different size grid, so I have to dynamically size the tile images.
Another physics issue is that the dragged tile appears to be going to sleep quickly, before they even reach the grid. I had to use physics.start(true) to keep them awake, but that seems to be going around whatever issue is causing it to sleep.
As far as physics and display groups, I’ve read that physics objects won’t interact unless they’re in the same display group. I made a main group named ‘game’ and added these objects to it, but that didn’t make a difference.
The code should be plug-n-playable. You can get the entire project, including the code and the tile images from my dropbox folder here:
https://www.dropbox.com/sh/6qxzalkvqwhlkfi/cDYp3cxXxo
[import]uid: 82378 topic_id: 25640 reply_id: 325640[/import]