Page 1 of 1

Best way to select (clone) actor sprite ?

PostPosted: Thu May 29, 2008 9:46 pm
by akhad
I have a grid of 4x4 clone actors, Tile.0 through to Tile.16. What's the best way to click on a single actor and get it's clone index ? So far I've been using a `cursor` actor parented to the cursor, and detecting it's collision wth the clone Tiles, but this is proving a less than satisfactory method. Anyone have a more efficient method of getting a clone number simply from clicking on it ?

Re: Best way to select (clone) actor sprite ?

PostPosted: Fri May 30, 2008 12:10 am
by DST
For one, you could use a global integer variable.

On clone>mousebuttondown
Code: Select all
variable=cloneindex;


Then you could so something with that variable.

You can also make it an array, if you like (you can make any global variable an array in the variables window)
and clone>mousebuttondown
Code: Select all
variable[n]=cloneindex;
//or
variable[cloneindex]=cloneindex;


Then you can refer to that variable later by using:
Code: Select all
newvariable=variable[n];
//or
newvariable=variable[cloneindex];



It all depends on what you want to do with it.