Hi All,
Sry for the naive question / bad coding: I wanted to drag all of my objects in x,z using wade.iso. Since I want to disable the drag/panning of the world tiles during object selection, I just thought of adding a flag when the pertinent object is MouseDown;
//( from this.init) objects.onMouseDown = function() { // Flag the object to avoid world camera moving, only object translation during drag. Remove object from position. SELECT = 1 objects.setVisible(false); return true } wade.addEventListener(objects, 'onMouseDown'); this.onMouseUp = function(eventData) { // Return the world manipulation flag, show object in new position after dragging. SELECT = 0 var worldCoords = wade.screenPositionToWorld(wade.iso.getTerrainLayerId(), eventData.screenPosition); var cellCoords = wade.iso.getCellCoordinates(worldCoords.x, worldCoords.y); objects.setVisible(true); wade.iso.moveObjectToCell(objects, cellCoords.x , cellCoords.z); };
This works, but only once. The second time I click the object in the new position wade_1.1.1.js complains "TypeError: b is undefined" and does not drag the object from its new position (the rest of the script runs business as usual).
This is the third attempt in a series of failed scripts for dragging, so I will appreciate it if you could point me in the right direction, even if the matter and hand seems trivial :). Also do you mind explaining how wade.iso.getObjectsInCell(cell.x, cell.z) works? Sometimes is seems it returns more than one Object, how to choose between then?
thanks!
CA