Game Development Community

Very handy coordinate extraction functions

by Bryan Edds · in Torque Game Builder · 07/08/2005 (5:43 pm) · 1 replies

Using these functions will make your code MUCH clearer, compact, and readable whereever you need to access just the x, y, x1, y1, x2, or y2 component of a coordinate variable in T2D.

/// number
	function x(%v){ return getWord(%v, 0);}
	/// number
	function y(%v){ return getWord(%v, 1);}
	/// number
	function x1(%v){ return getWord(%v, 0);}
	/// number
	function y1(%v){ return getWord(%v, 1);}
	/// number
	function x2(%v){ return getWord(%v, 2);}
	/// number
	function y2(%v){ return getWord(%v, 3);}

Rocks!