Gio,
I am working on something like a matching game where selected scene objects are pushed onto a list.
The player would mouse down on the first object to start the list, and then drag the mouse over other objects to add them as well.
I currently do this in the mouseMove handler.
The call to self.select() just adds the scene object to the selected list if it is a new scene object.
this.onMouseMove = function(eventData) { if (wade.isMouseDown()) { var sToW = wade.screenPositionToWorld(self.GAME_LAYER,eventData.screenPosition); var oArr = wade.getObjectsInArea({minX: sToW.x-5, minY: sToW.y-5, maxX: sToW.x+5, maxY: sToW.y+5},self.GAME_LAYER); if (oArr.length > 0 && oArr[0].isJelly) { self.select(oArr[0]); } } // end mouse is down return true;} // end onMouseMove
It all currently works fine.
But I have a couple of questions:
1) is there an easier way to figure out if the mouse is over a scene object, either in the event data, or some other call I don't know about ?
2) what is a good tolerance for the bounding box in the getObjectsInArea call ?
3) if there is not already a call, would it be possible to add something in the future for the mouse / touch similar to the sceneObject.getOverlappingObjects() function ?
As always, any help is appreciated !
cheers,
Shri