hey all.
at the last days i had reaching an code to animate the ball but now i have an thinking error the compiler out from checking the (if statement when it's apply the first statement i want it to continue checking i want to animate the ball to be in an three closed walls to impact with it and at the fourth wall the blade make it's objective to keep the ball between the three walls and the blade ..
here is the code

action bar()
{
while(1)
{
if (key_a)
{
c_move (my, vector(0, 0, -10 * time_step), nullvector, GLIDE);
}
if (key_d)
{
c_move (my, vector(0, 0, 10 * time_step), nullvector, GLIDE);
}
wait (1);
}
}

action ball()
{
var ball_speed =30;
var top_border= 100;
var Rside_border= 400;
var Lside_border= -200;
while(1)
{
c_move (my, vector(0, 0, ball_speed * time_step), nullvector, GLIDE);
c_move (my, vector(0, -ball_speed * time_step, 0), nullvector, GLIDE);


if (my.z>=top_border)
{
my.z-=3 -random(3);
my.y+=3 +random(3);

if(my.y<=Lside_border)
{
my.y-=ball_speed*time_step - random(3);
my.z+=ball_speed*time_step + random(3);
}
if (my.y>=Rside_border)
{
my.y+=ball_speed*time_step -random(3);
my.z+=ball_speed*time_step + random(3);
}
}
wait(1);
}
}

hint the actions is assigned to the models the bar and the ball. and the game is 2d game the ball and bar are models . the level consisting in an sprite as background.


Last edited by EID; 09/23/10 06:19.