Transition OnComplete Events

I was wondering, I have a few transitions that have an oncomplete event. Mostly these are used to decide if a tile should keep moving. A simple example of a bullet:

transition.to(bulletVisual, {time=PLAYER\_SPEED/4, x=bulletVisual.x, y=bulletVisual.y+tileSize,onComplete=bulletMove})  

It all works fine, but my question is, what is the most optimal way to get the physical tile inside of that onComplete event. I’ve been using the x and y values, and getting the physical tile via getTileAt. I have to do a full search since my tiles move and it’s pretty rough on performance to have to do that every time I’m moving a tile. It was too big of an issue when I was dealing with simple tiles, but I think it’s going to be a huge sink when it comes to something that moves quickly and often like a bullet tile. I feel like I’m doing it wrong. Any thoughts or am I doing it correctly? [import]uid: 114566 topic_id: 29258 reply_id: 329258[/import]

Do you mean that in the example you gave, you want to get to bulletVisual in the bulletMove function? If you declare the function like this:

local function bulletMove(tile)

then bulletVisual will be passed to you in the “tile” parameter. [import]uid: 160496 topic_id: 29258 reply_id: 117656[/import]

No, I want the actual physical representation, not the sprite/visual. I’m getting the visual in the onComplete just fine. I’m just trying to find the best way to get the actual tile itself. I don’t want to have to do a getTileAt and use the x and y coords of the visual. It’s a pretty heavy process since I need to use the full parameter because my tiles move. I just wasn’t sure if that’s the best practice. I need to be able to access the actual tile so I can destroy it when certain things happen. [import]uid: 114566 topic_id: 29258 reply_id: 117664[/import]

I think I can just use slideToPosition. It gives me access to the actual tile in the onComplete function without the overhead. [import]uid: 114566 topic_id: 29258 reply_id: 117669[/import]