Best way to select (clone) actor sprite ?

Non-platform specific questions.

Best way to select (clone) actor sprite ?

Postby akhad » Thu May 29, 2008 9:46 pm

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 ?
User avatar
akhad
 
Posts: 43
Joined: Tue Jan 16, 2007 1:59 pm
Location: U.K
Score: 0 Give a positive score

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

Postby DST » Fri May 30, 2008 12:10 am

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.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron