Game Development Reference
In-Depth Information
dropTarget returns
a value.
dropTarget doesn't
return a value.
Figure 10-3. dropTarget returns only a reference to the
object that mouse is directly over.
Because of this limitation, you might find yourself using `nklP]ncap infrequently, and it might be little
or no use at all for sophisticated drag-and-drop games. Instead, you might want to consider using
depPaopK^fa_p to find the names of the objects that the drag object is passing over. This will be a bit
more work to set up because you need to store the names of all possible targets in an array and loop
through each frame to check whether they're colliding with the drag object. You don't quite have the
skills to do this yet, but you will by the end of this chapter.
Snapping the object to the target
The code that actually snaps the drag objects to their targets sits in an AJPAN[BN=IA event handler:
lner]pabqj_pekjkjAjpanBn]ia$arajp6Arajp%6rke`
w
eb$na`Omq]na*depPaopK^fa_p$na`P]ncap%%
w
eb$[eo@n]ccejc%
w
na`Omq]na*t9na`P]ncap*t7
na`Omq]na*u9na`P]ncap*u7
y
y
eb$^hqaOmq]na*depPaopK^fa_p$^hqaP]ncap%%
w
eb$[eo@n]ccejc%
w
^hqaOmq]na*t9^hqaP]ncap*t7
^hqaOmq]na*u9^hqaP]ncap*u7
y
y
y
 
Search Nedrilad ::




Custom Search