Game Development Community

[Solved] Getting an object my clicking on it

by Luis E Pabon · in iTorque 2D · 09/23/2011 (1:16 am) · 3 replies

I'm curious to know if there is an already implemented way to get an object by clicking on it. For example, I'd like to lock the camera on a sprite I click on.

Using sceneWindow's onMouseDown method is an option, but would require some tinkering to grab an object in the area you click on.

Update: Michael Perry is a very classy gent. Marked as solved.

#1
09/23/2011 (9:34 am)
Every sprite can use the onMouseDown method. Just use that.
#2
09/23/2011 (10:50 am)
Didn't think of that, thanks. Do you know if this method works on the iPhone hardware as well? This is an iTGB project, I just posted it on the wrong forum.
#3
09/23/2011 (12:34 pm)
I'll move it to the right forum. For iT2D 1.4.1 and below, onMouseDown will work. For 1.5, you want to use onTouchDown.