With Smiley Showdown the movement was very basic, the smileys went in one of 4 directions and once they hit the edge of the stage would end back where it started.
I wanted to make the movement a bit more random and interesting with this version, I decided to make each smiley have a random angle that it accelerated against. The problem with this though is making sure the angle isn’t too restrictive, what if the smiley doesn’t get enough screen time because the angle is to sharp and head’s off the stage instantly.

You can tell that I don't make the artwork for my games...
I want the smiley’s to stay on the screen atleast past the middle of the stage, making the levels fair. To do this I give each smiley a target in the center of the stage to go to and continue past, this way they have to stay at least till the center of the stage before it can go off the screen. So I need to work out two xy coordinates, the location of the smiley and the target location, the target being a random point on the y axis in the center of the stage. Like this:

I work out the distance between the points and use the Math.atan2 function to get the angle.
I calculate the angle between the two points and give it to the smiley to accelerate along. The smiley should now get a decent amount of screen time, here it is in action:
I hope that made sense…

