Only drag and drop One actor ? HELP?
Ok i have thought of a way to recycle my actors.
When they are out the screen and you tap somewhere, i want that actor to move to the touch position.
BUT, there might be 5 of the same actor out of the screen waiting to be recycled, so how could i make it so that it only drag and drops one of the actors at a time??
thanks.
JamieOneil
When they are out the screen and you tap somewhere, i want that actor to move to the touch position.
BUT, there might be 5 of the same actor out of the screen waiting to be recycled, so how could i make it so that it only drag and drops one of the actors at a time??
thanks.
JamieOneil
Comments
In the recycled actor create an integer called selfID
then in that actor do this:
change game.actorCount to game.actorCount+1
change self.selfID to game.actorCount
What this does is automatically give each instance of this actor a unique ID number. The lowest one on the actor list under scene layers will get number one and it will count up from there.
Then you can use this ID number in so many ways. For example you will probably want another game attribute (integer) called game.CurrectActor
Then have a rule that says when mouse is down change game.CurrentActor to game.currentActor+1
Then in the recycled actor have a rule that says when self.seflID=game.CurrentActor
interpolate x to ????
interpolate y to ????
Now each time you click the next actor will go where you tell it to.
But is there a video tutorial or something anywhere.
Im still a bit confused.
JamieOneil
JamieOneil
Create one actor and do this:
Create a game integer attribute called actorCount.
In the actor create an integer called selfID
then in that actor do this:
change game.actorCount to game.actorCount+1
change self.selfID to game.actorCount
display text self.ID
Then drag a few of these actors into the scene and preview. This will show you the unique ID on each actor.
And i have been able to put it in my app.
It works great!
thanks very much for your help.
JamieOneil
http://gamesalad.com/game/3279