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:
From the GameCore::dragBall function:
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.
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.
Torque Owner Chase Webb