problem 1: my camera view start to shacking when i move my mouse y axis to look upwards or downards.
Problem 2: when my character look upwards and i press forward, i start to float upwards
problem 3: when i look downwards and press forward half of the character body will start to stuck in the floor.
problem 4: when i press jump my character keep going upwards and half of the character body stuck in the ceiling and wont come down .
problem 5: when i press shift to let it run, it have no effect and my character cant go up the stair.
problem 6: there is no animation for my character when i move my character, my character just change location but no animation

Code:



var video_mode=7;
var video_depth=32;
var move_vec[3]=0,0,0;
var idle_percent=0;
var walk_percent=0;
var run_percent=0;
var temptilt = 0;
var distance_traced;
var from_vec;
var to_vec;
var ttemp;
Var land_percent = 60;
Var jump_percent = 0;
DEFINE falling,skill30; // 0 for not falling 1 for falling
DEFINE fall_distance,skill31; // distance to fall
DEFINE jumping,skill32;
DEFINE jump_hight,skill33;
DEFINE BATTERY,skill13; //current battery units
DEFINE ARMOR,skill14; //current armor units
DEFINE HEALTH,skill15; //current health units
DEFINE AMMO,skill16; //current ammo units
DEFINE BATTERY_MAX,skill17; // max battery units
DEFINE ARMOR_MAX,skill18; // max armor units
DEFINE HEALTH_MAX,skill19; // max health units
DEFINE AMMO_MAX,skill20; // max ammo units
DEFINE Keys,skill21; //keeps track of what keys have been picked up
DEFINE idle_percent,skill40; // animation frame cycle % values
DEFINE walk_percent,skill41;
DEFINE run_percent,skill42;
DEFINE land_percent,skill43;
DEFINE jump_percent,skill44;
DEFINE temptilt,skill50;
DEFINE Walk_Anm_Speed,skill1; //walk speed . animation walk speed
DEFINE Walk_Anm_Speed,skill1; //walk speed . animation walk speed
DEFINE Run_Anm_Speed,skill2; // int * walkspeed =run speed . animation run speed
DEFINE Strafe_Anm_Speed,skill3; //strafe speed . animation strafe speed
DEFINE Jump_Walk_Run,skill10; // walk/stand jump height . run jump height
DEFINE move_vec_x,skill98; // movement vector uses skills 98 99 and 100
DEFINE move_vec_y,skill99;
DEFINE move_vec_z,skill100;



action display_glass
{
my.alpha = 25;
my.transparent = on;
}

Action dummy_action
{
wait(1);
}

action player_move
{
player = me;
wait(1);
my.falling = 0;
my.jumping = 0;
my.jump_hight = 0;
my.idle_percent = 0;
my.walk_percent = 0;
my.run_percent = 0;
my.land_percent = 60;
my.jump_percent = 0;
my.temptilt = 0;
Camera.genius = player;
shift_sense = int(my.run_anm_speed);

while (player !=NULL)
{
move_vec[0] = (key_w - key_s + key_cuu - key_cud ) * 20 * time; //moving forward and backward
move_vec[1] = (key_a - key_d + key_comma - key_period) * 15 * time; //strafe movements
distance_traced = trace(from_vec,to_vec);
vec_set( temp.x, player.x); // copies player x/y/z/ to the temp vector
ttemp.z -=4000; // we set the temp vector 4000 quants straight down, below the player entity
trace_mode = IGNORE_ME+IGNORE_SPRITES+IGNORE_MODELS+USE_BOX; // like move_mode and ent_move, trace_mode line must be RIGHT before the actual trace instruction
trace(player.x,temp.x); // traces from the player x/y/z to the modified temp x/y/z
My.fall_distance = trace(my.x,temp);
player.tilt-= mouse_force.y * -4 * time;
player.pan -= (mouse_force.x) * 35 * time; //using the mouse to turn left and right
move_mode = IGNORE_YOU + IGNORE_PASSABLE + IGNORE_PUSH + ACTIVATE_TRIGGER + GLIDE; // move mode parameters to avoid sticking on walls and models
player.tilt-= mouse_force.y * -10 * time;
ent_move(move_vec,NULLVECTOR);

// check if jumping
if (my.jumping !=0)
{
jump_handling();
}


fall_handling();
// check if player pressed jump X and isn't already jumping or falling
if (key_space)
{
if(my.jumping == 0 && my.falling == 0 && my.fall_distance <1)
{
my.jumping = 1 + key_shift; // if holding shift key when hit jump means we were running
move_vec.z = 20*time; // starting jump speed velocity
}
}

if (!my.falling&& my.jumping ==0) // if falling = 0 then !falling is = 1, or true that I'm not falling
{
move_vec.x = (key_w - key_s + key_cuu - key_cud ) * int(my.walk_anm_speed) * time; //moving forward and backward
move_vec.y = (key_a - key_d + key_comma - key_period) * 15 * time;//strafe movements
}

If (my.fall_distance >32)
{
my.falling = 1; // now I'm falling
if (move_vec.z > -20*time) // if not falling at maximum fall rate
{
move_vec.z -= .5*time; // then increase my fall rate
}
}
if(my.jumping!=0)// animate jump
{
jump_animate();
}
else
{
if(my.falling == 1)
{
if (my.fall_distance > 32)
{
ent_animate(me,"jump",60,anm_add);
}
else
{
if (int(my.land_percent) !=0 ) // not done with animation yet
{
my.land_percent = (my.land_percent +8*time)%100;
ent_animate(me,"jump",my.land_percent,ANM_ADD); // animate landing
}
if (my.fall_distance < 0) // have I fallen under a surface?
{
move_vec.z = -my.fall_distance*time; // if so, move me back up
}
}
else

// landing animation done
{
my.falling = 0; // we are no longer falling
my.land_percent = 60; // reset land_percent for the next time we might fall
}

}
}



If (move_vec[0] == 0 && move_vec[1] == 0)
{
stand_animate();
}
else
{
if(key_shift)
{
run_animate();
}
}
else

{
walk_animate();
}
/*
vec_set(temp,my.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp); // now MY looks at YOU

vec_set (Camera.x,player.x);
camera.z += 40;
camera.pan = player.pan;
camera.tilt =Player.tilt*4*time;
*/

wait(1);
}
}



function main()
{
level_load("Level1.wmb");
wait(2);
}

function jump_handling()
{
if ( (my.jump_hight > int(my.Jump_Walk_Run) && my.jumping == 1) || (my.jumping == 2 && my.jump_hight > (frc(my.Jump_Walk_Run)*100) ) )
{
my.jumping = 0;
my.move_vec_z = 0;
my.jump_hight = 0;
my.jump_percent = 0;
}
else
{
if (my.move_vec_z > 1*time)
{
my.move_vec_z -= .5*time;
my.jump_hight += my.move_vec_z;
}
else
{
my.move_vec_z = 1*time;
my.jump_hight += my.move_vec_z;
}

}
}
function fall_handling()
{
If (my.fall_distance >64 && sign(my.fall_distance) != -1 && my.jumping ==0 )
{
my.falling = 1; // now I'm falling
if (my.move_vec_z > -15*time)
{
my.move_vec_z -= .5*time;
}
}
else
{
if ( my.fall_distance < 64 && my.falling == 0 && my.jumping ==0 ) // keep us on the floor normally
{
my.move_vec_z = -my.fall_distance*time;
}
}
}

function stand_animate()
{
my.idle_percent = (my.idle_percent +5*time)%100;
ent_animate(me,"idle",my.idle_percent,ANM_CYCLE);
}

function walk_animate()
{
my.walk_percent = (my.walk_percent + sign(my.move_vec_x)*(frc(my.walk_anm_speed)*10)*time)%100;
ent_animate(me,"walk",my.walk_percent,ANM_CYCLE);
}

function run_animate()
{
my.run_percent = (my.run_percent + sign(my.move_vec_x)*(frc(my.run_anm_speed)*10)*time)%100;
ent_animate(me,"run",my.run_percent,ANM_CYCLE);
}

function jump_animate()
{
if (my.jump_percent < 50)
{
ent_animate(me,"jump",my.jump_percent,ANM_ADD);
my.jump_percent = (my.jump_percent +8*time)%60; // give some added room here so the jump_percent can get over 50 for our if check
}
}