NICE MARBLE BALST ACTION CLONE ;)

Posted By: Raymaker

NICE MARBLE BALST ACTION CLONE ;) - 05/12/07 13:44

this is the code for the marble blast clone.
Apply this action to any object and add this vars:

HOPE YOU LIKE IT!!!

var ball_rotation[3];
var cam_rot[5];
var angcam_rot;
var ball_rotation2[3]



;Code:
 action ball
phent_settype(my,PH_RIGID,PH_SPHERE);
phent_setmass(my,15,PH_SPHERE);
phent_setdamping(my,5,5);
phent_setfriction(my,80);
while(1){
ball_rotation.x=0;
ball_rotation.y=0;
ball_rotation.z=0;
ball_rotation2.x=0;
ball_rotation2.y=0;
ball_rotation2.z=0;


cam_rot.pan-=2*key_a;
cam_rot.pan+=2*key_d;

angcam_rot=ang(cam_rot);


camera.x=my.x-500*cos(cam_rot);
camera.y=my.y-500*sin(cam_rot);
camera.z=my.z+250;

vec_set(my_posi,my.x);
vec_sub(my_posi,camera.x);
vec_to_angle(camera.pan,my_posi);

if(abs(angcam_rot)<=90)
{

if(angcam_rot<0){
ball_rotation.x=(90-abs(angcam_rot))*key_force.x;
ball_rotation.y=-abs(angcam_rot)*key_force.x;
ball_rotation2.y=(90-abs(angcam_rot))*key_force.y;
ball_rotation2.x=abs(angcam_rot)*key_force.y;
}if(angcam_rot>0){


ball_rotation.x=(90-abs(angcam_rot))*key_force.x;
ball_rotation.y=abs(angcam_rot)*key_force.x;
ball_rotation2.y=(90-abs(angcam_rot))*key_force.y;
ball_rotation2.x=-abs(angcam_rot)*key_force.y;
}

}

if(abs(angcam_rot)>=90)
{

if(angcam_rot<-90){
ball_rotation.x=-(abs(angcam_rot)-90)*key_force.x;
ball_rotation.y=-(180-abs(angcam_rot))*key_force.x;
ball_rotation2.y=-(abs(angcam_rot)-90)*key_force.y;
ball_rotation2.x=(180-abs(angcam_rot))*key_force.y;
}
if(angcam_rot>90){

ball_rotation.x=-(abs(angcam_rot)-90)*key_force.x;
ball_rotation.y=(180-abs(angcam_rot))*key_force.x;
ball_rotation2.y=-(abs(angcam_rot)-90)*key_force.y;
ball_rotation2.x=-(180-abs(angcam_rot))*key_force.y;
}




}

phent_addtorqueglobal(my,ball_rotation);
phent_addtorqueglobal(my,ball_rotation2);
wait(1);
}

}


Posted By: Trooper119

Re: NICE MARBLE BALST ACTION CLONE ;) - 05/12/07 18:37

Perhaps a screenshot of it working in action? Just a suggestion
Posted By: Scorpion

Re: NICE MARBLE BALST ACTION CLONE ;) - 05/12/07 19:28

how do you want to show a marble in action?^^
Posted By: Joozey

Re: NICE MARBLE BALST ACTION CLONE ;) - 05/15/07 00:01

Gif animation :B
© 2024 lite-C Forums