Sprite sheet animation and the transition.to() function?

The transition.to() function seems like a capable way of moving NPCs around on screen (am I correct that this is an ideal way of moving characters?).

Can anyone point me in the direction of how to trigger sprite animations off of movement?

I’m having fun prototyping my game with rectangles(squares) but I need to start figuring out how to use some art assets.

Thanks in advance for any help you can offer! :slight_smile: [import]uid: 105707 topic_id: 28274 reply_id: 328274[/import]

You can indeed move NPCs around this way. For triggering sprite animations from movement you’d use different sequences and each transition would start a different one playing. It may be worth looking at this tutorial; http://corona.techority.com/2011/05/01/using-sprites-in-your-corona-iphone-application/

It doesn’t involve transitions but does cover the rest of it and you could likely adapt it quite easily :slight_smile: [import]uid: 52491 topic_id: 28274 reply_id: 114296[/import]

Hi Peach,

I appreciate the input. I had looked at your tutorial some time back and am glad to be redirected back to to it. Very helpful :slight_smile:

My take away from considering this is that the only difference between using the transition.to() function and a “npc.x = npc.x + motion.x” type of solution that you have is that the transition.to() function has already solved a lot of the behind the scenes math for me when moving to a specified x,y location.

Is there any other difference that I’m missing? In either case, the NPC object is still the physics object that I’ve set it as, correct?

Thanks for the info. :slight_smile:

[import]uid: 105707 topic_id: 28274 reply_id: 114338[/import]

No, you aren’t missing anything - but changing the sprite animation based on the direction the sprite was moving what my main point in directing you to that specific tutorial; I was unsure on your previous sprite experience :wink:

Have you figured out how to change the animation playing with each of your transitions? Let me know.

Peach :slight_smile: [import]uid: 52491 topic_id: 28274 reply_id: 114436[/import]

Hi Peach,

I’ve not attempted to set this all up yet…

I’ve realized that although the transition.to() solves a lot of the “behind the scenes math” I would need to set up with a more traditional .x/.y shift system, I do still need to work some math to be able to determine which animation to play based on which direction I’m going. So I guess in some ways it’s a wash, although the transition.to() does have the benefit of being able to use non-linear motion :slight_smile:

I’m working with a grid system where characters will only move in x and y directions so that helps simplify some things. I’m still having some weirdness with setting up that grid and detecting what character is where.

I’ll keep you posted, thanks for the guidance :slight_smile:

[import]uid: 105707 topic_id: 28274 reply_id: 114475[/import]

Don’t get me started on grid systems - super useful but can be tricky as all get go sometimes.

Please do keep me posted, don’t know how useful my guidance actually was in this case but nonetheless it’s always there when requested :wink:

Look forward to seeing how you go!

Peach :slight_smile: [import]uid: 52491 topic_id: 28274 reply_id: 114574[/import]