OH i have Pro...
and ive reg my entities
all the balls have same drag and firction(and mass)

p.s but if the ball hit a wall or bound the N force is applied
maybe it will need a colison detection code for balls?

edit:
here is my code
(Key_u) is insted of the aiming and power code i just want to test it first.

Code:

entity* cueball;
entity* 1ball;
entity* 2ball;
entity* 3ball;
entity* 4ball;
entity* 5ball;
entity* 6ball;
entity* 7ball;
entity* 8ball;
entity* 9ball;
entity* 10ball;
entity* 11ball;
entity* 12ball;
entity* 13ball;
entity* 14ball;
entity* 15ball;

bmap cueballb = <1cue.pcx>;
bmap 1ballb = <1.pcx>;
bmap 2ballb = <2.pcx>;
bmap 3ballb = <3.pcx>;
bmap 4ballb = <4.pcx>;
bmap 5ballb = <5.pcx>;
bmap 6ballb = <6.pcx>;
bmap 7ballb = <7.pcx>;
bmap 8ballb = <8.pcx>;
bmap 9ballb = <9.pcx>;
bmap 10ballb = <10.pcx>;
bmap 11ballb = <11.pcx>;
bmap 12ballb = <12.pcx>;
bmap 13ballb = <13.pcx>;
bmap 14ballb = <14.pcx>;
bmap 15ballb = <15.pcx>;

material cueballm
{
skin4 = cueballb;
}


function setup_balls()
{
//starting setup balls pos!
//cueball:
var cueballsetup[3] = -368, -32, -448;
var cueskin = 3;
cueball = ent_create (mdlb, cueballsetup, NULL);
cueball.skin = cueskin;
cueball.metal = ON;
cueball.albedo = 70;
cueball.ambient =20;
//cueball.material = cueballm;
//1st ball:
var 1ballsetup[3] = 192, -32, -448;
1ball = ent_create (mdlb, 1ballsetup, NULL);
1ball.metal = ON;
1ball.albedo = 70;
1ball.ambient =20;
//2nd ball:
var 2ballsetup[3] = 224, -48, -448;
2ball = ent_create (mdlb, 2ballsetup, NULL);
2ball.metal = on;
2ball.albedo = 70;
2ball.ambient = 20;
//3rd ball:
var 3ballsetup[3] = 224, -16 , -448;
3ball = ent_create (mdlb, 3ballsetup, NULL);
3ball.metal= on;
3ball.albedo = 70;
3ball.ambient = 20;
//4th ball:
var 4ballsetup[3] = 256, -64, -448;
4ball = ent_create (mdlb, 4ballsetup, NULL);
4ball.metal = on;
4ball.albedo = 70;
4ball.ambient = 20;
//5th ball:
var 5ballsetup[3] = 256, -32, -448;
5ball = ent_create (mdlb, 5ballsetup, NULL);
5ball.metal = on;
5ball.albedo = 70;
5ball.ambient = 20;
//6th ball:
var 6ballsetup[3] = 256, 0, -448;
6ball = ent_create (mdlb, 6ballsetup, NULL);
6ball.metal = on;
6ball.albedo = 70;
6ball.ambient= 20;
//7th ball:
var 7ballsetup[3] = 288, 16, -448;
7ball = ent_create (mdlb, 7ballsetup, NULL);
7ball.metal = on;
7ball.albedo = 70;
7ball.ambient= 20;
//8th ball:
var 8ballsetup[3] = 288,-48, -488;
8ball = ent_create (mdlb, 8ballsetup, NULL);
8ball.metal = on;
8ball.albedo = 70;
8ball.ambient= 20;
//9th ball:
var 9ballsetup[3] = 288, -16, -448;
9ball = ent_create (mdlb, 9ballsetup, NULL);
9ball.metal = on;
9ball.albedo = 70;
9ball.ambient= 20;
//10th ball:
var 10ballsetup[3] = 320, -66, -448;
10ball = ent_create (mdlb, 10ballsetup, NULL);
10ball.metal = on;
10ball.albedo = 70;
10ball.ambient= 20;
//11th ball:
var 11ballsetup[3] = 288, -80, -448;
11ball = ent_create (mdlb, 11ballsetup,NULL);
11ball.metal = on;
11ball.albedo = 70;
11ball.ambient= 20;
//12th ball:
var 12ballsetup[3] = 320, -32, -448;
12ball = ent_create (mdlb, 12ballsetup, NULL);
12ball.metal = on;
12ball.albedo = 70;
12ball.ambient= 20;
//13th ball:
var 13ballsetup[3] = 320, 0, -448;
13ball = ent_create (mdlb, 13ballsetup, NULL);
13ball.metal = on;
13ball.albedo = 70;
13ball.ambient= 20;
//14th ball:
var 14ballsetup[3] = 320, -64, -448;
14ball = ent_create (mdlb, 14ballsetup, NULL);
14ball.metal = on;
14ball.albedo = 70;
14ball.ambient= 20;
//15th ball:
var 15ballsetup[3] = 320, 32, -448;
15ball = ent_create (mdlb, 15ballsetup, NULL);
15ball.metal = on;
15ball.albedo = on;
15ball.ambient = on;
//Done setup ball pos!
}
}

function ball_ph()
{

var grav[3] = 0, 0, -1500;
ph_setgravity(grav);
phent_settype (cueball,ph_rigid, ph_sphere);
phent_settype (1ball,ph_rigid, ph_sphere);
phent_settype (2ball,ph_rigid, ph_sphere);
phent_settype (3ball,ph_rigid, ph_sphere);
phent_settype (4ball,ph_rigid, ph_sphere);
phent_settype (5ball,ph_rigid, ph_sphere);
phent_settype (6ball,ph_rigid, ph_sphere);
phent_settype (7ball,ph_rigid, ph_sphere);
phent_settype (8ball,ph_rigid, ph_sphere);
phent_settype (9ball,ph_rigid, ph_sphere);
phent_settype (10ball,ph_rigid, ph_sphere);
phent_settype (11ball,ph_rigid, ph_sphere);
phent_settype (12ball,ph_rigid, ph_sphere);
phent_settype (13ball,ph_rigid, ph_sphere);
phent_settype (14ball,ph_rigid, ph_sphere);
phent_settype (15ball,ph_rigid, ph_sphere);

phent_setmass(cueball, 1.5, ph_sphere);
phent_setmass(1ball, 1.5, ph_sphere);
phent_setmass(2ball, 1.5, ph_sphere);
phent_setmass(3ball, 1.5, ph_sphere);
phent_setmass(4ball, 1.5, ph_sphere);
phent_setmass(5ball, 1.5, ph_sphere);
phent_setmass(6ball, 1.5, ph_sphere);
phent_setmass(7ball, 1.5, ph_sphere);
phent_setmass(8ball, 2, ph_sphere);
phent_setmass(9ball, 1.5, ph_sphere);
phent_setmass(10ball, 1.5, ph_sphere);
phent_setmass(11ball, 1.5, ph_sphere);
phent_setmass(12ball, 1.5, ph_sphere);
phent_setmass(13ball, 1.5, ph_sphere);
phent_setmass(14ball, 1.5, ph_sphere);
phent_setmass(15ball, 1.5, ph_sphere);

phent_setdamping(cueball, 20, 20);
phent_setdamping(1ball, 20, 20);
phent_setdamping(2ball, 20, 20);
phent_setdamping(3ball, 20, 20);
phent_setdamping(4ball, 20, 20);
phent_setdamping(5ball, 20, 20);
phent_setdamping(6ball, 20, 20);
phent_setdamping(7ball, 20, 20);
phent_setdamping(8ball, 20, 20);
phent_setdamping(9ball, 20, 20);
phent_setdamping(10ball, 20, 20);
phent_setdamping(11ball, 20, 20);
phent_setdamping(12ball, 20, 20);
phent_setdamping(13ball, 20, 20);
phent_setdamping(14ball, 20, 20);
phent_setdamping(15ball, 20, 20);

phent_setfriction(cueball, 20);
phent_setfriction(1ball , 20);
phent_setfriction(2ball , 20);
phent_setfriction(3ball , 20);
phent_setfriction(4ball , 20);
phent_setfriction(5ball , 20);
phent_setfriction(6ball , 20);
phent_setfriction(7ball , 20);
phent_setfriction(8ball , 20);
phent_setfriction(9ball , 20);
phent_setfriction(10ball , 20);
phent_setfriction(11ball , 20);
phent_setfriction(12ball , 20);
phent_setfriction(13ball , 20);
phent_setfriction(14ball , 20);
phent_setfriction(15ball , 20);

phent_setelasticity (cueball, 50, 2);
phent_setelasticity (1ball, 50 ,2);
phent_setelasticity (2ball, 50 ,2);
phent_setelasticity (3ball, 50 ,2);
phent_setelasticity (4ball, 50 ,2);
phent_setelasticity (5ball, 50 ,2);
phent_setelasticity (6ball, 50 ,2);
phent_setelasticity (7ball, 50 ,2);
phent_setelasticity (8ball, 50 ,2);
phent_setelasticity (9ball, 50 ,2);
phent_setelasticity (10ball, 50 ,2);
phent_setelasticity (11ball, 50 ,2);
phent_setelasticity (12ball, 50 ,2);
phent_setelasticity (13ball, 50 ,2);
phent_setelasticity (14ball, 50 ,2);
phent_setelasticity (15ball, 50 ,2);

while(1)
{
if (key_u)
{
var boom[3] = 8000,0,0;
phent_addcentralforce(cueball,boom);

}

wait(1);
}
}



Last edited by Matan_Golan_A6; 04/03/04 03:22.