Hallo,
ich benutze folgenden Code:
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
VECTOR ball_force;
ENTITY* ball;
function main()
{
level_load("level2.wmb"); // load the level
ball = ent_create ("ball.mdl", vector(-400, 0, 100), NULL); // create the ball
ph_setgravity (vector(0, 0, -400)); // set the gravity
phent_settype (ball, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (ball, 3, PH_SPHERE); // and its mass
phent_setfriction (ball, 100); // set the friction
phent_setdamping (ball, 40, 40); // set the damping
phent_setelasticity (ball, 30, 30); // set the elasticity
while (1)
{
ball_force.y = 150 * time_step * ((key_cuu || key_w) - (key_cud || key_s));
ball_force.x = 150 * time_step * ((key_cur || key_d) - (key_cul || key_a));
ball_force.z = 0;
phent_addtorqueglobal (ball, ball_force);
camera.y = ball.y;
camera.z = ball.z + 200;
camera.x = ball.x-300;
camera.tilt = -25;
if (key_cud || key_s)
{
camera.x=ball.x-700;
}
if (key_space || ball.z<10)
{
phent_setdamping (ball, 85, 85); // Spiele mit diesen Werten hier
} else {
phent_setdamping (ball, 0, 0);
}
wait (1);
}
}
Mein Problem, nach dem starten des Scripts, friert mein Spiel für etwa 4 Sekunden ein und dann geht es auf einmal ganz normal. Wenn ich einen Medialoop in das Script einbaue und es starte, friert wieder nur das Spiel für etwa 4 Sekunden ein und die Musik läuft weiter. Woran liegt das? Ist mein Pc einfach zu lahm?