Showing posts with label breakout. Show all posts
Showing posts with label breakout. Show all posts

Monday, February 22, 2016

Shuffa Brick juicy style

In the new game I'm writing, Shuffa Brick, I had each level start with all bricks already in place, functional but a bit dull to look at. After watching another great YouTube video on Juicy game design, I decided to add a bunch of the juicy effects described in the video.

 Juice it or lose it

Animate the bricks coming onto the screen

In the video I saw they used an animation curve to provide the location that the brick should be. So given a ratio of time along the x axis, this will give you a ratio along the y axis for how far it is from the destination, the cool thing is that this can be further than the destination as in my example below, so it gives a little bounce effect.

 my brick curve

If we want the total journey time to be 1 second then after 0.25 secs in according to the curve we will have traveled 50% of the way to the final destination (calling curve.Evaluate(timeGap) would return 0.5 for the y axis value).

Fancy particle effect on the ball

Next thing I added was a particle effect on the ball, the idea is that it leaves a flame like trail behind the ball.
To do this I changed the Color over lifetime going from yellowy to orangish color with a alpha fade.


Explosion effect on the brick

Then an explosion effect when a brick gets destroyed. This is another particle effect to do this I set the same color over lifetime as the ball. I add speed and a gravity modifier to give it the effect.


Comparison Non Juicy vs Juicy


Saturday, January 30, 2016

Re-using Unity 2D animations by changing the Sprite at run-time.

In my new game Shuffa brick, I have a number of same sized bricks that I want to animate once and re-use the animation for all colours of the bricks.

I created the animation using a green brick, then in the editor I changed the sprite renderer to use a different coloured sprite.

The change works in the editor, but when running the game it reverted back to the green brick.


In code I tried updating the sprite of the renderer in the Update() of the GameObject but that didn't work either. In the debugger I could see it getting changed but again it went back to the Green brick at run-time.

So in effect what happens is that the animator overwrites whatever sprite we set in code with the one in the animation.

Unite 2014 - 2D Best Practices In Unity

I watched a really good video on YouTube, the important part is where he talks of Sprite animation re-skinning. All I needed from the video was just one word LateUpdate (31mins in). The code in the LateUpdate() is ran after the animator has done it's work. So if we change the renderer's sprite at this moment it stays changed.





Brick animations with LateUpdate()