🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Moving tile in match-3 game smoothly or simulating physics effects

Started by
2 comments, last by Alexander Nazarov 5 years, 2 months ago

Hello. I'm pretty new in Unity and I wonder how and what should I use in Unity to create smooth and physics-like tile moving in my match-3 game?

 

 

This is example of game, where tile movements are most attractive for me 

 

Advertisement

I think I commented on your other related thread, so I'll try chipping in here as well.

First, if you haven't already, you might find it useful to watch portions of the video you posted at reduced speed, or step by step (',' and '.' keys on YouTube, as of this writing at least). By doing so I noticed a few things:

- The falling of items is 'staggered', by which I mean that an item falls, and then the item above it starts falling a bit later, rather than all items falling at exactly the same time.

- The items seem to fall with simple acceleration, or close to it.

- When the items reach their new positions, a tight spring effect is applied, starting with a downward motion consistent with the item's previous velocity.

The next part just represents my personal inclinations. Others may recommend a different approach.

Because the behavior involves physics, it might be tempting to try to leverage Unity's physics system to implement item behavior. If it were my project though, I'd probably use analytic rather than numerical/iterative solutions, because the physics is (probably) simple enough to lend itself to that, and using analytic solutions may have some advantages. For example, you can easily determine in advance how long the animations will take, and you don't have to worry about any of the vagaries of iterative physics simulation (not that there would necessarily be any issues with something this simple).

The falling behavior can be implemented easily with so-called SUVAT equations. The spring is a little trickier. I've done that sort of thing before - I don't remember exactly how I did it, but I think I decided that a sine-wave-based animation with steadily decreasing amplitude was close enough (the initial amplitude was based on the item's ending velocity to effect a smooth transition between the falling and spring animations).

For simplicity's sake, you could start by implementing the falling behavior using analytic equations, as that part should be pretty easy, and then tackle the spring animation subsequent to that. (Another possibility would be to do the falling animation analytically and the spring animation iteratively, if that seems easier.)

@Zakwayda thanks man, I will try your approach

This topic is closed to new replies.

Advertisement