Create a flash draw game like Line Rider or others – A different approach

April 21st update: part 2 released
June 15th update: part 3 released

Some days ago I received a very very interesting email from Kevin W. (for Kevin: I can give you more credits if you send me some information about you).

It refers to the Line Rider game creation, with a different approach.

Read carefully:


I was reviewing parts three and four of your line rider tutorials today because I had never tried out your collision and reaction techniques for myself, when I found some things I didn’t like.

Mostly, the practice of combining and extracting angles constantly using trig, and therefore the need to compensate for the differences between degrees and radians. I didn’t want to do this because I’ve had a lot of bad luck with my own experiments.

I was reminded of a book on Flash MX game design I saw a few months ago. I remembered the author talking about using vectors exactly for this purpose which eliminates the need for taxing trigonometry functions.

The idea is to keep the x and y speeds separate, and use normalization and scalars to determine the resultant speed.

I think the result is somewhat more efficient and basically keeps track of the ball’s momentum which would lead well into the concepts of sliding required for a sled-based game.

I haven’t yet incorporated your fixes for the ball sticking in the terrain and losing energy, but I would like to know what you think of my approach to this problem.

I hope you take this as gratitude on my part for your tutorials. I started in January of this year using just your blog.

By the way, I am Izy who commented on your posts, the one who made the rocket game with the missile.


Kevin sent a fully commented actionscript too, here it is:

Then, Kevin fixed another problem… read:


I noticed that if you change the code

speed.x += -(normal_x*total_speed);
speed.y += -(normal_y*total_speed);


speed.x = -(normal_x*total_speed)*friction;
speed.y = -(normal_y*total_speed)*friction;

it will behave almost identically to your part four code without the sticking bug.


What to say? First, I want to thank Kevin for this precious feedback… then, I am going to study this code and eventually use it in future updates of this tutorial.

Here it is his working final movie

And this is the source code.

Any comment?