///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
VECTOR ball_speed;
action InitBal(){
set(my, SHADOW);
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 = 25 * (key_cur - key_cul); // move the ball using the cursor keys
ball_speed.y = 25 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
camera.x = my.x - 100; // keep the camera 100 quants behind the ball
camera.y = my.y; // using the same y with the ball
camera.z = 400; // and place it at z = 400 quants
camera.tilt = -60; // make it look downwards
wait (1);
}
}
function main()
{
fps_max = 140;
shadow_stencil = 1;
level_load("test.wmb"); // load the level
wait (2); // wait until the level is loaded
ph_setgravity (vector(0, 0, -386)); // set the gravity
}