Game Development Community

ActionMap Confusion

by Chase Webb · in Torque 2D Beginner · 02/27/2015 (12:33 am) · 3 replies

Hello world! I'm curious as to why my drag actionmap isn't working. I wanted a function to be called when a finger is moved, but I'm not getting any output when the finger moves. Here are some snippets:

From within my onTouchDown function:

//This is the ActionMap in case a drag function for the single finger is needed. Create a new ActionMap for input binding
				new ActionMap(DragMap);
				DragMap.bind(touchdevice, "touchmove", "GameCore::dragBall");
				DragMap.push();
				echo("Drag Map is Active!");


From the GameCore::dragBall function:

function GameCore::DragBall(%touchIDs, %touchesX, %touchesY){

      // X screen coordinate
      %curX = getWord( %touchesX, 0 );
      
      // Y screen coordinate
      %curY = getWord( %touchesY , 0 );

	$CurrentObject.MoveTo(%curX SPC %curY, 10, true, 32);
	echo($CurrentObject SPC " should have been moved to " SPC %curX SPC %curY);
	
}

Before you ask what the moveto command is doing there, don't worry about it. It's just for testing so I can move on to two-finger inputs. MoveTo aside, the echo doesn't run either, so I'm not sure what the deal is.

#1
03/03/2015 (8:59 pm)
So.... it's been days now. I've been trying countless things, including stuff from old TGB and T3D guides for Actionmaps, and I simply haven't gotten a single mouse bind to work. Any idea what I'm doing wrong? Anyone have a working example?
#2
03/04/2015 (11:11 am)
Whoa - mouse events enabled on scenewindow?
#3
03/05/2015 (9:08 pm)
Since regular functions like onTouchDown work, then yes?