I'm writing a puzzlegame where you need to place some items on a playfield. The game is controlled by touch controls. The playfield is some kind of a tilemap. If the user touches on some location of the tilemap he should add a new sprite directly located on top of the tile he has touched before, so that he can place some items on this "map".
How can I do it? I'm not really sure how to find the location on the grid where the player has touched so that I can place the new sprite on it?!
Thanks for any help,
Develop games in your browser. Powerful, performant & highly capable.
You might find this to be helpful:
you going to have to spawn new objects(sprite) on touch and set them to touched location right?
Your question about to touched location:
Off the Top of my head, can't say if it works for sure, but the recipe is here:
Click on sprite - Set position type in X input box touch.X and do same for Y
Something like that.
You gonna have to play around
Should be hard at all
On Touched | Create object at ( floor(Touch.X/TileSize)*TileSize , floor(Touch.Y/TileSize)*TileSize )