I'm not looking for someone to give away an entire project. Perhaps I should have been more informative.

What I'm looking for is simply to be pointed in the right direction. I've had a look around and this is what I've found so far:

with (obj_collisionsphere)
{
if (other.id!=id)
{
// check if other balls are in collision distance
dist = point_distance(x,y,other.x,other.y)
intersect = rad+other.rad-dist
// move balls outside of each other if they are intersecting
if (intersect >= 0)
{
x += lengthdir_x(intersect/2,point_direction(other.x,other.y,x,y))
y += lengthdir_y(intersect/2,point_direction(other.x,other.y,x,y))
other.x += lengthdir_x(intersect/2,point_direction(x,y,other.x,other.y))
other.y += lengthdir_y(intersect/2,point_direction(x,y,other.x,other.y))
xx = (x-other.x)/(rad+other.rad);
xy = (y-other.y)/(rad+other.rad);
// implementation of found physics formulas
x1 = point_distance(0,0,velx,vely)*cos(degtorad(abs(point_direction(0,0,xx,xy)-point_direction(0,0,velx,vely))))
v1xx = xx * x1;
v1xy = xy * x1;
v1yx = velx - v1xx;
v1yy = vely - v1xy;
xx *= -1;
xy *= -1;
x2 = point_distance(0,0,other.velx,other.vely)*cos(degtorad(abs(point_direction(0,0,xx,xy)-point_direction(0,0,other.velx,other.vely))))
v2xx = xx * x2;
v2xy = xy * x2;
v2yx = other.velx - v2xx;
v2yy = other.vely - v2xy;
tmass = mass;
other.tmass = other.mass;
if (tmass <= 0) { tmass = 1000000; }
if (other.tmass <= 0) { other.tmass = 1000000; }
if (mass > 0)
{
velx = v1xx*(tmass-other.tmass)/(tmass+other.tmass) + v2xx*(2*other.tmass)/(tmass+other.tmass) +v1yx
vely = v1xy*(tmass-other.tmass)/(tmass+other.tmass) + v2xy*(2*other.tmass)/(tmass+other.tmass) +v1yy
}
if (other.mass > 0)
{
other.velx = v1xx*(2*tmass)/(tmass+other.tmass) + v2xx*(other.tmass-tmass)/(tmass+other.tmass) +v2yx
other.vely = v1xy*(2*tmass)/(tmass+other.tmass) + v2xy*(other.tmass-tmass)/(tmass+other.tmass) +v2yy
}
}
}
}

*Courtesy of Jake Armstrong*

I understand *some* of this but I'm having trouble implementing it. I've declared all the variables needed but I'm not sure what I should do with the velocity variables (velx and vely). I've parented obj_ball to obj_collisionsphere and they share the same size. The balls are 64x64px big so the rad variable is 32. The mass variable I had no idea what to do with so I simply set it to 1.

With a little bit of work I managed to get the balls to move with the mouse when "selected". With this I could see if the collision worked properly and it did. So now my only problem is how to get the "shot" to work. How to get the balls moving.

Any ideas?

My apologies if I sound clueless. It's because I am.

**Edited by milo-rd, 30 March 2013 - 01:15 PM.**