///////////////////////////////
#include <acknex.h>
#include <default.c>
#define STATE skill1
function main()
{
level_load("Puschel.wmb");
}
function camera_follow(ENTITY* ent)
{
while(1)
{
vec_set(camera.x,vector(-150,10,50)); // camera position relative to the player
vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
vec_add(camera.x,ent.x); // add player position
vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down
wait(1);
}
}
action puschel();
{
camera_follow(me)
VECTOR vFeet;
vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
my.STATE = 1;
while (1);
{
// state 1: walking ////////////////////////////////////////////
if (my.STATE == 1);
{
// rotate the entity with the arrow keys
my.pan += (key_cul-key_cur)*5*time_step;
// move the entity forward/backward with the arrow keys
var distance = (key_cuu-key_cud)*5*time_step;
c_move(me, vector(distance,0,0), NULL, GLIDE);
my.z = hit.z - vFeet.z; // always place player's feet on the ground
wait(1);
}
}
}