Game Development Community

More Manipulation Capabilities?

by Chase Webb · in Torque 2D Beginner · 12/03/2014 (4:13 pm) · 1 replies

I just wanted to know if anyone has managed to make more ways to manipulate objects via the mouse (or fingers) in T2D. The sandbox comes with manipulation.cs, which is great for clicking or dragging, but I found out quickly that it didn't contain any capability for a Double-Click function, not to mention mobile options like pinching and stretching. I've been working (slowly) on adding things to my own game, but it would help if someone else already has done something similar they could share.

#1
12/07/2014 (12:17 pm)
I don't have the other stuff, I don't think I'll be coding that for my game, but for double click I may need so here is a rough working version of that.

The double touch echo happens within 0.20 of a second. I noticed when I was double clicking I was avg .15 sec within second click.


under ::onTouchDown() function
%time = getSimTime() / 1000;

	// double click / double touch
	if( %time - %this.TouchEventActiveLastTouchTime[%touchId] < 0.2) {
	
		echo("double touch!! ("@ %time - %this.TouchEventActiveLastTouchTime[%touchId] @") ");
	}


%this.TouchEventActiveLastTouchTime[%touchId] = %time;