#include <acknex.h>
#include <default.c>
#include <camera.c>
///////////////////////////////
function main()
{
level_load("Level1.WMB");
wait(2);
}
action player_walk()
{
//move_stat: beginnend bei 0 wird erhöht,
//ist der Bewegungsablauf der Entity
var move_stat = 0;
var move_dir = 0;
var dist_down;
var dist=0;
VECTOR vFeet;
vec_for_min(vFeet,me);
var move=0;
while(1)
{
move=0;
dist_down = c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
//wenn a gedrückt wird...
if(dist_down> -vFeet.z)
{
dist --;
}
else
{
dist = dist_down;
}
if(key_space && dist_down<=2)
{
dist = 15;
}
if(key_a)
{
//...dann wird die Entity nach links gedreht
my.pan=90+1*90;
//animation run wird ausgeführt
ent_animate(me, "run",move_stat,ANM_CYCLE);
move_stat+=0.5;
//entity bewegt sich auf der xAchse 2 nach links
//es scheint, als bewege sie sich
//my.x-=2;
//c_move(my,NULL,vector(-10,0,0),GLIDE);
// c_move(my,vector(2,0,0),nullvector,GLIDE);
move = -2;
}
else
{
//wenn weder a noch d gedrückt wird, dann stellt
//sich die entity in richtung des Spielers
my.pan=45+1*45*5;
//animation stand wird ausgeführt
ent_animate(me, "stand", move_stat, ANM_CYCLE);
move_stat+=0.5;
}
if(key_d)
{
//wenn d gedrückt wird, dann dreht sich die
//Figur nach rechts
my.pan = -90+1*90;
//animation run wird wieder ausgeführt
ent_animate(me,"run", move_stat, ANM_CYCLE);
move_stat+=0.1;
//Entity bewegt sich auf der xAchse 2 nach rechts
//my.x+=2;
//c_move(my,nullvector,vector(2,0,0),GLIDE);
move = 2;
}
c_move(my,nullvector, vector(move,0,dist),GLIDE);
cam();
wait(1);
}
}