I created the following applet. It is similar to what you want.
You can change initial positions with different initialization code and add rules for your game.

You can drag from the center of the blue particle to change it's velocity when it is in paused state.
The blue particle will start to move when you release the mouse.
You can change the friction coefficient mu and elastic coefficient k.
k=1 means elastic collision without energy. k<1 then energy is loss due to collision.

Because the particle move in the same direction when there is no collision.
The friction force F=\mu N= \mu m g, from F=ma
The energy loss is \vec{F}\cdot d\vec{s}= F d where d is the distance traveled.
d can be calculated between each time step.
And kinetic energy will be loss due to friction.  \tfrac{1}{2}mv'^2=\tfrac{1}{2}mv^2- F d
So I re-calculate velocity after each time step.
And if the right hand side become smaller than zero, it means that the particle should have been stopped.
(So velocity has to be set to zero).

I think I should only help you from the physics point of view.
The rest work should be your job, waiting for you to finish it.

I will be glad to help you if you have questions related to physics!

/htdocs/ntnujava/ejsuser/2/users/ntnu/fkh/collisiongame_pkg/collisiongame.propertiesFull screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(1360.6kB):double click downloaded file to run it. (8 times by 3 users) , Download EJS source (4 times by 3 users) View EJS source