i managed to make a code:
var life = 100;
var life2 = life;
var fall = 0;
var life_for_fall = 100;
var fall_prec = 1;
ENTITY* stair;
PANEL* pDisplayy =
{
pos_x = 10;
pos_y = 20;
digits (10, 10, 5, *, 1, fall);
flags = VISIBLE;
}
PANEL* pDisplayyy =
{
pos_x = 10;
pos_y = 40;
digits (10, 10, 5, *, 1, life_for_fall);
flags = VISIBLE;
}
PANEL* pDisplay =
{
pos_x = 10;
pos_y = 30;
digits (10, 10, 5, *, 1, life);
flags = VISIBLE;
}
function main()
{
video_mode = 7;
level_load ("work.wmb");
fps_max = 150;
wait (2); // wait until the level is loaded
}
action stair()
{
VECTOR temp;
while (1)
{
c_move (my, vector(0, 0, -25 * time_step), nullvector, GLIDE);
player = me;
camera.x = player.x - 100 * cos(player.pan);
camera.y = player.y - 100 * sin(player.pan);
camera.pan = player.pan; // the camera and the player have the same pan angle
camera.z = player.z + 70; // place the camera above the player, play with this value
camera.tilt = -25;
vec_set(temp, my.x);
temp.z -= 5; // trace downwards 500 quants below
c_trace (my.x,temp,IGNORE_ME);
if(c_trace (my.x,temp,IGNORE_ME) == 0)
fall += fall_prec * time_step;
if(c_trace(my.x,temp,IGNORE_ME) > 0)
fall = 0;
if (fall > 100)
life = 0;
if (fall += fall_prec * time_step)
life_for_fall -= 1 * time_step;
if (c_trace(my.x,temp,IGNORE_ME) > 0)
life = life2 - life_for_fall;
if (c_trace(my.x,temp,IGNORE_ME) > 0)
fall_prec = 0;
if (life < 0)
life = 0;
wait(1);
}
}
tested and works fine but i'm not sure if it is very logical...so the ideea is:If it falls more than 100 metters it dies...if it falls a metter life -= 1
Last edited by Ted22; 02/03/10 13:06.