The ball prefab is just a sphere with a rigid body, with the Z constrained. I had initially tried placing an empty quad in front and behind but found this was better for performance & visuals. The first PoC was just to get a bunch of them filling up a screen, and as the video above shows, that was completed well. Because its physics based, and not defined slots, there is some variance in how they line up.
Next I added click to destroy. Easy enough, using OnMouseEnter/OnMousExit to set a bool and if that is set, onclick, destroy(gameObject). But destroy wasn't visual enough, so I added a simple explosion. A while ago, I picked up the asset FX Mega Pack from the asset store, and I'm using modified version of one of their explosions.
Next I daisy chained all the touching (or close to touching) items of similar color and separated the destruction by a fraction of a second each, so you can see the chain effect.
Lastly, I added a bunch more block types and a score system. You get 1 point for each block, but each daisy chained item gets you the number of points as its position in the destruction. so 1 block = 1 point. 2 blocks = 2 points (1 + 2) and so on.
No comments:
Post a Comment