// // ------------------TOUCH METHODS-------------------------------------// // function terrain::onTouchDown(%this, %event) // { // // FIXME: if top-left corner, do not responde // if (t2dVectorCompare(%event.point, 0 SPC 0, 0)) // { // return; // } // %tempFinger = new t2dStaticSprite() // { // imageMap = "movementImageMap"; // }; // %tempFinger.setSize(5 SPC 5); // %tempFinger.addToScene(sceneWindow2D.getSceneGraph()); // %tempFinger.setPosition(%event.point); // %tempFinger.setLifetime(0.8); // $touchStartingPoint[%event.id] = new ScriptObject(){ // point = %event.point; // }; // } // function terrain::onTouchMove(%this, %event) // { // // FIXME: if top-left corner, do not responde // if (t2dVectorCompare(%event.point, 0 SPC 0, 0)) // { // return; // } // %tempFinger = new t2dStaticSprite() // { // imageMap = "movementImageMap"; // }; // %tempFinger.setSize(5 SPC 5); // %tempFinger.addToScene(sceneWindow2D.getSceneGraph()); // %tempFinger.setPosition(%event.point); // %tempFinger.setLifetime(0.8); // } // function terrain::onTouchUp(%this, %event) // { // // FIXME: if top-left corner, do not responde // if (t2dVectorCompare(%event.point, 0 SPC 0, 0)) // { // return; // } // %distance = t2dVectorDistance(%event.point, $touchStartingPoint[%event.id].point); // $touchStartingPoint[%event.id].Delete(); // if (%distance >= $goCommandThreshold){ // $d3xpos = getWord(%event.point, 0)/$scaleunit; // $d3ypos = getWord(%event.point, 1)/$scaleunit; // // sendPosition($d3xpos, $d3ypos); // echo("sending: ", $d3xpos, " and ", $d3ypos); // alxPlay(roarSound); // } // } // // ---------------------MOUSE METHODS------------------------------------// // $mouseTouchCount = 0; // function terrain::onMouseDown(%this, %modifier, %worldPosition, %clicks) // { // // if(%worldPosition == Player1PositionVariable) // // { // %tempFinger = new t2dStaticSprite() // { // imageMap = "movementImageMap"; // }; // %tempFinger.setSize(5 SPC 5); // %tempFinger.addToScene(sceneWindow2D.getSceneGraph()); // %tempFinger.setPosition(%worldPosition); // %tempFinger.setLifetime(0.8); // $mouseTouchStartingPoint[$mouseTouchCount] = new ScriptObject(){ // point = %worldPosition; // }; // // }else return; // } // function terrain::onMouseDragged(%this, %modifier, %worldPosition, %clicks) // { // if(%worldPosition == Player1PositionVariable); // { // %tempFinger = new t2dStaticSprite() // { // imageMap = "movementImageMap"; // }; // // $Player1Move.addNode(%worldPosition, -1, 10.0,0.0) // %tempFinger.setSize(5 SPC 5); // %tempFinger.addToScene(sceneWindow2D.getSceneGraph()); // %tempFinger.setPosition(%worldPosition); // %tempFinger.setLifetime(0.8); // } // else return; // // %this.moveTo(%worldPosition, 0.4, false, true, true, 10.1); // // moveTo(%targetX, %targetY, %speed, [%autoStop = true], [%callback = false], [%snap = true], [%margin = 0.1]) // // (mouseTouch@$mouseTouchCount).setPosition(%worldPosition); // } // function terrain::onMouseUp(%this, %modifier, %worldPosition, %clicks) // { // %distance = t2dVectorDistance(%worldPosition, $mouseTouchStartingPoint[$mouseTouchCount].point); // $mouseTouchStartingPoint[$mouseTouchCount].Delete(); // if (%distance >= $goCommandThreshold){ // $d3xpos = getWord(%worldPosition, 0)/$scaleunit; // $d3ypos = getWord(%worldPosition, 1)/$scaleunit; // sendPosition($d3xpos, $d3ypos); // echo("sending: ", $d3xpos, " and ", $d3ypos); // alxPlay(roarSound); // } // %this.moveTo(%worldPosition, 0.4, true, false, true, 0.1); // $mouseTouchCount++; // if($AmmoFired == false && $AmmoLoaded = true) // { // echo("here"); // %behavior = cannonWeapon.getBehavior(); // %behavior.fire(1); // %behavior.fire(0); // } // }