helft mir bitte !
function jump()
{
ENTITY* ball;
phent_addvelcentral(ball,vector(0,0,1000*time_step));
}
action ball()
{
VECTOR ball_speed;
ENTITY* ball;
var rot_angle = 0;
var rot_height = 0;
VECTOR offset;
var jumptimer = -1.5;
on_space = jump;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
vec_rotate(ball_speed,vector(camera.pan,0,0)); //Die Zeile rotiert deinen Bewegungsvektor mit der Kamera
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,-rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;
if(my.z<-850)
{
ent_remove(my);
game_load("level",1);
return;
}
wait (1);
}
}