Hello mate.I got the same problem but i managed to solve it.Here's my script:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
var walk_percentage;
var run_percentage;
var walk_percentage2;
var death_percentage;
var guard_rotate;
ENTITY* stair;
var stand_percentage;
ANGLE* guard;
ENTITY* guard;
ENTITY* blocks;
function main()
{
video_mode = 7;
level_load ("work21.wmb");
wait (2); // wait until the level is loaded
}
action walking_guard()
{
c_setminmax(my);
guard = me;
while (1)
{
set(me,FAT);
set(me,NARROW);
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;
if (key_w)
ent_animate(my,"walk",walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 3 * time_step; // 3 = animation speed for "walk"
if (key_w)
c_move (my, vector(3.5 * time_step, 0, 0), nullvector, GLIDE);
if (key_w)
move_min_z = 0.4 * time_step * 60; //this is the most important part
if (key_s)
ent_animate(my,"walk",walk_percentage2, ANM_CYCLE); // "walk" animation loop
walk_percentage2 += 3 * time_step; // 3 = animation speed for "walk"
if (key_s)
c_move (my, vector(-2 * time_step, 0, 0), nullvector, GLIDE);
if (key_a) me.pan += 5 * time_step;
if (key_d) me.pan -=5 * time_step;
if (key_w && key_shiftl)
ent_animate(my,"run",run_percentage, ANM_CYCLE); // "walk" animation loop
run_percentage += 7 * time_step; // 3 = animation speed for "walk"
if (key_d && key_w)
ent_animate(my,"walk",walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 0 * time_step; // 3 = animation speed for "walk"
if (key_a && key_w)
ent_animate(my,"walk",walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 0 * time_step; // 3 = animation speed for "walk"
if (key_shiftl && key_w)
c_move (my, vector(7 * time_step, 0, 0), nullvector, GLIDE);
if (key_shiftl && key_w && key_d)
ent_animate(my,"run",run_percentage, ANM_CYCLE); // "walk" animation loop
run_percentage += 0 * time_step; // 3 = animation speed for "walk"
if (key_shiftl && key_w && key_a)
ent_animate(my,"run",run_percentage, ANM_CYCLE); // "walk" animation loop
run_percentage += 0 * time_step; // 3 = animation speed for "walk"
if (key_any == 0)
ent_animate(my,"stand",stand_percentage, ANM_CYCLE); // "walk" animation loop
stand_percentage += 4 * time_step; // 3 = animation speed for "walk"
if (key_any == 0)
c_move (my, vector(0 , 0, -35 * time_step), nullvector, 0); //this is the gravity
if (key_any == 1)
c_move (my, vector(0 , 0, -35 * time_step), nullvector, 0); //this is the gravity
wait(1);
}
}
////Sorry,there are some things that are not about climbing the stairs.For the things that u don't know,look on reference manual.Please tell me if it helped
Last edited by Ted22; 04/18/10 04:58.