Yes i'm using Kh movement code.

_______________________________________________________________________________

Code:

function scan_floor();
FUNCTION rotate_entity(rotate_angle,rotate_speed);

DEFINE nullframe,-2;
DEFINE blend,-1;
DEFINE stand,0;
DEFINE run,1;
DEFINE walk,2;
DEFINE jump,3;
DEFINE fall,4;
DEFINE attack_a,5;
DEFINE attack_b,6;
DEFINE attack_c,7;
DEFINE attack_d,8;
DEFINE attack_e,9;
DEFINE attack_f,10;

DEFINE move_x,skill22;
DEFINE move_y,skill23;
DEFINE move_z,skill24;
DEFINE force_x,skill25;
DEFINE force_y,skill26;
DEFINE force_z,skill27;
DEFINE velocity_x,skill28;
DEFINE velocity_y,skill29;
DEFINE velocity_z,skill30;
DEFINE animate,SKILL31;
DEFINE animate2,SKILL32;
DEFINE animblend,SKILL33;
DEFINE currentframe,SKILL34;
DEFINE blendframe,SKILL35;

DEFINE z_offset,SKILL50;
DEFINE jumping_mode,SKILL51;
DEFINE gravity,SKILL52;
DEFINE movement_mode,SKILL53;
DEFINE moving,SKILL54;
DEFINE hit_by_player,SKILL55;
DEFINE entity_type,SKILL56;

DEFINE HP, skill57;
DEFINE ATTACK,skill58;
DEFINE DEFENCE,skill59;
Define ATTACK_MODE,flag1;

entity* player_weapon;
entity* target_enemy;


var camera_move_to[3];
var camera_distance = 200;
var camera_pan;
var camera_tilt;

var camera_move_to[3];
var camera_view_to[3];

var fade_toggle = 1; //0 = off; 1 = on
var fade_start = 90;
var fade_end = 60;
var temp3[3];

var space_press = 0;
var mouse_left_press = 0;
var mouse_right_press = 0;
var combo_continue = 0;
var player_lock_on = 0;
var airborne_attack = 0;

var temp2[6];

ACTION attach_weapon {
player_weapon = my;
my.passable = on;
proc_late();
WHILE (you != null) {
vec_for_vertex(temp.x,you,1175); //hand palm base
vec_for_vertex(temp2.x,you,1240); //hand palm tip
vec_set(my.x,temp.x);
vec_diff(temp.x,temp2.x,temp.x);
vec_to_angle(temp.pan,temp.x);
vec_set(my.pan,temp.pan);
wait(1);
}
}

ACTION player_action
{
player = my;
my.entity_type = 0;
my.gravity = 6;
my.z_offset = 6;
my.shadow = on;
ent_create("sword.mdl",my.x,attach_weapon);
player.HP = 25; //initial HP value
player.ATTACK = 5; //initial sword attack value
player.DEFENCE = 1; //initial armor defence value
wait(1);
WHILE (1) { //the main loop
handle_gravity();
handle_movement();
handle_camera();
handle_animation(1);
my.skill60 = 0; //Death
if(player.hp <= 0)
{
player.hp = 0;
while(my.skill60 < 75)
{
my.skill60 += 1;
ent_animate(me,"knockdown",my.skill60,anm_cycle+anm_add);
my.animate += 100 * time; // this changes the animation speed.
my.animate %= 100;
wait(20);
}
wait(48);
exit;
}//
wait(1);
}
}

FUNCTION handle_movement() {
temp.x = -1000;
temp.y = 0;
my.moving = 0;
IF (key_w == 1 && key_s == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan; }
IF (key_s == 1 && key_w == 0 && key_a == 0 && key_d == 0) { temp.x = camera.pan + 180; }
IF (key_a == 1 && key_s == 0 && key_w == 0 && key_d == 0) { temp.x = camera.pan + 90; }
IF (key_d == 1 && key_s == 0 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 90; }
IF (key_w == 1 && key_a == 1 && key_d == 0 && key_s == 0) { temp.x = camera.pan + 45; }
IF (key_w == 1 && key_d == 1 && key_a == 0 && key_s == 0) { temp.x = camera.pan - 45; }
IF (key_s == 1 && key_a == 1 && key_d == 0 && key_w == 0) { temp.x = camera.pan + 135; }
IF (key_s == 1 && key_d == 1 && key_a == 0 && key_w == 0) { temp.x = camera.pan - 135; }
IF (temp.x != -1000) {
my.moving = 1;
IF (key_shift == 1) { temp.y = 10 * time; } ELSE { temp.y = 15 * time; }
}

IF (my.movement_mode == 0) {
my.move_x = fcos(temp.x,temp.y);
my.move_y = fsin(temp.x,temp.y);
}
IF (my.movement_mode == 1 || my.movement_mode == 2) {
temp.y = fsin((my.animate * 1.2) + 45,15 * time);
my.move_x = fcos(my.pan,temp.y);
my.move_y = fsin(my.pan,temp.y);
temp.y = 0;
IF (temp.x != -1000) { //if we need to rotate whilst attacking (the player is pressing keys to rotate)
temp.y = 1;
}
}

scan_floor();
c_move(my,nullvector,my.move_x,use_aabb | glide | ignore_passable);

IF (target_enemy == null) {
IF (temp.y > 0) { rotate_entity(temp.x,30); }
} ELSE {
vec_diff(temp2.x,target_enemy.x,my.x);
vec_to_angle(temp2.pan,temp2.x);
rotate_entity(temp2.pan,30);
}

IF (my.movement_mode == 0) {
my.gravity = 6;
IF (my.move_x != 0 || my.move_y != 0) { //if we are moving
IF (my.animblend == stand) { //if our current animation is stand
IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
}
IF (my.animblend == run && key_shift == 1) { my.blendframe = walk; }
IF (my.animblend == walk && key_shift == 0) { my.blendframe = run; }
} ELSE {
IF (my.animblend > stand && my.animblend != jump && my.animblend != fall) { //if we arn't moving and our current animation is walk or run, blend and cycle the stand animation
my.blendframe = stand;
}
}
IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; }
IF (mouse_left == 1 && mouse_left_press == 0 && my.animblend >= stand) {
mouse_left_press = 1;
my.blendframe = attack_a;
player.ATTACK_MODE = on;
IF (my.jumping_mode == 1) {
airborne_attack = 1;
} ELSE {
airborne_attack = 0;
}
my.movement_mode = 1;
combo_continue = 0;
}
IF (mouse_right == 0 && mouse_right_press == 1) { mouse_right_press = 0; } ///////////////
IF (mouse_right == 1 && mouse_right_press == 0) {
IF (player_lock_on == 0) {
c_scan(player.x,player.pan,vector(360,180,250),scan_ents | scan_limit); //
IF (you != null) {
IF (you.entity_type == 2) { //make sure you've scanned an enemy
player_lock_on = 1;
target_enemy = you;
}
}
} ELSE {
player_lock_on = 0;
target_enemy = null;
}
mouse_right_press = 1;
}
}
IF (my.movement_mode == 1) {
IF (my.jumping_mode != 10) {
my.jumping_mode = 0;
} ELSE {
IF (my.animate >= 60 && my.animblend >= stand) { my.jumping_mode = 0; }
}
IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; }
IF (mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) { mouse_left_press = 1; combo_continue = 1; }
}
IF (my.movement_mode == 2 && my.movement_mode == 0) {
my.jumping_mode = 0;
IF (mouse_left == 0 && mouse_left_press == 1) { mouse_left_press = 0; }
IF (mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) { mouse_left_press = 1; combo_continue = 1; }
}
}

FUNCTION handle_gravity()
{
var friction = 0.7;
result = c_trace(vector(my.x,my.y,my.z-5),vector(my.x,my.y,my.z - 1000),use_box | ignore_me | ignore_passable | ignore_models);
IF (result > 10)
{
IF (my.jumping_mode == 2)
{
IF (result > 120)
{
my.animate = 60;
my.jumping_mode = 3;
}
ELSE
{
my.jumping_mode = 0;
}
}
IF (my.jumping_mode == 3 && result <= 120) { my.jumping_mode = 0; }
IF (my.jumping_mode == 0 && my.movement_mode == 0)
{
IF (result > 120 && my.animblend >= stand && my.animblend != jump && my.animblend != fall) {
my.jumping_mode = 3;
my.blendframe = fall;
my.animate2 = 0;
my.animblend = blend;
}
}
my.force_z -= my.gravity * time;
IF (my.movement_mode == 2) { my.force_z = 0; }
}
ELSE
{
IF (my.jumping_mode == 0)
{
my.force_z = -0.1 * result;
IF (key_space == 0 && space_press == 1) { space_press = 0; }
IF (key_space == 1 && space_press == 0 && my.movement_mode == 0 && my.animblend >= stand && my.animblend != jump && my.animblend != fall)
{
space_press = 1;
my.jumping_mode = 1;
my.force_z = 20; //25
my.blendframe = jump;
my.animate2 = 0;
my.animblend = blend;
}
IF (my.jumping_mode == 2 || my.jumping_mode == 3) { my.jumping_mode = 0; }
}


}
if(result >= 0 && result <= 10 && my.jumping_mode != 1)
{
my.z -= result;
my.velocity_z = 0;
my.force_z = 0;
}
my.velocity_z = time_step * my.force_z + max(1-time_step * friction,0) * my.velocity_z;
my.move_z = my.velocity_z * time;
}

//////////////////////////////
//Smooth camera collision
//////////////////////////////
FUNCTION handle_camera() {
camera_pan -= mouse_force.x * 12 * time;
camera_tilt += mouse_force.y * 8 * time;
camera_tilt = clamp(camera_tilt,-50,50);

camera.pan = camera_pan;
camera_distance = fcos(camera_tilt,200);
temp = fcos(camera_tilt,-camera_distance);
vec_set(camera_move_to.x,vector(my.x + fcos(camera.pan,temp),my.y + fsin(camera.pan,temp),my.z + 20 + fsin(camera_tilt,-camera_distance)));

temp = min(1,0.2 * time); //changing 0.5 will change how fast the camera moves, at 1 places us at target, this value is what allows the smooth movement
camera.x += temp*(camera_move_to.x - camera.x);
camera.y += temp*(camera_move_to.y - camera.y);
camera.z += temp*(camera_move_to.z - camera.z);

vec_diff(temp.x,camera.x,my.x);
vec_normalize(temp.x,16);
vec_add(temp.x,camera.x);


c_trace(my.x,temp.x,ignore_me|ignore_passable);

IF (result > 0) {
vec_diff(temp.x,my.x,target.x);
vec_normalize(temp.x,16);
vec_set(camera.x,target.x);
vec_add(camera.x,temp.x);
}

vec_set(camera_view_to.x,my.x);
vec_diff(temp.x,my.x,camera.x);
vec_to_angle(temp.pan,temp.x);
camera.pan = temp.pan;
camera.tilt = temp.tilt + 6;

vec_diff(temp.x,my.x,camera.x);
vec_to_angle(camera.pan,temp.x);
if(fade_toggle == 1)
{
vec_diff(temp.x, my.x, camera.x);
if(fade_start > 0)
{
temp3.x = vec_length(temp.x); // distance from camera to target
if(temp3.x < fade_start)
{
my.transparent = on; // fade to zero depending distance to fade end
player_weapon.transparent = on;
my.shadow = off;
player_weapon.shadow = off;
//NOTE: use 1st max to avoid negative alpha
//use 2nd max to avoid divide by zero
my.alpha = 100 * max(0, ((temp3.x - fade_end) / max(1,(fade_start - fade_end))));
player_weapon.alpha = my.alpha;
}
else
{
my.transparent = off;
player_weapon.transparent = off;
my.shadow = on;
player_weapon.shadow = on;
}
}
}
}

FUNCTION rotate_entity(rotate_angle,rotate_speed) {
IF (my.pan == rotate_angle) { return; }
result = ang(rotate_angle - my.pan);
IF (result > 0) { my.pan += rotate_speed * time; }
IF (result < 0) { my.pan -= rotate_speed * time; }
IF (ang(rotate_angle - my.pan) < 0 && result > 0) { my.pan = rotate_angle; }
IF (ang(rotate_angle - my.pan) > 0 && result < 0) { my.pan = rotate_angle; }
}

FUNCTION handle_sword_collision {
you = null;
vec_for_vertex(temp.x,player_weapon,274); //sword base
vec_for_vertex(temp2.x,player_weapon,54); //sword tip
trace_mode = ignore_me+ignore_passable+use_box;
result = trace(temp.x,temp2.x);
IF (you != null) {
IF (you.entity_type == 2 && you.hit_by_player == 0) {
IF (airborne_attack == 1 && my.animblend == attack_a) {
my.movement_mode = 2;
}
you.hit_by_player = 1;
IF (target_enemy == null) { target_enemy = you; player_lock_on = 1; }
}
}
}