Game Development Community

Capture Mouse Click on a Tile Map

by Mark Newnam · in Torque Game Builder · 05/10/2007 (12:02 pm) · 3 replies

I have searched for help on capturing mouse clicks but can't seem to get it working. I am using TGB 1.5 Indie and am working with a level that has a tilemap on it. What I want to be able to do is capture where a mouse click occured on the tilemap and return the X/Y position so I can change the tile that was clicked.

Any help on this would be greatly appreciated..

Thanks,
Mark

#1
05/11/2007 (10:06 am)
In an onMouseDown event you can send the world position to the pickTile function and it will return the coords if any of what tile is under that position.
tdn.garagegames.com/wiki/TGB/Reference:_t2dTileLayer#pickTile.28.25position.29

Greg
#2
05/13/2007 (7:27 am)
@Mark:

[edit] Actually I'm used to my own map stuff, you have to use the tile layers or scene window.

Will update in a minute with a better example.
#3
05/13/2007 (6:12 pm)
Neo,

I got it working, thanks. What I did was pretty close to what you mentioned originally.

Thanks for the help.

Mark