action platform_action()
{
var platform_rotation_speed = 0.1;//Rotation Speed of the platform
var car_rotation_speed = 0.5;//rotation speed of the car
ENTITY* car1;//Pointer to all the cars
ENTITY* car2;
ENTITY* car3;
ENTITY* car4;
//Create the cars at 4 edges of the platform
car1 = ent_create("car.mdl",vector(my.x + 50,0,0),NULL);//Place the car 50 quands over 0
car2 = ent_create("car.mdl",vector(my.x - 50,0,0),NULL);//Place the car 50 quands under 0
car3 = ent_create("car.mdl",vector(0,my.y + 50,0),NULL);//Place the car 50 quands right from 0
car4 = ent_create("car.mdl",vector(0,my.y - 50,0),NULL);//Place the car 50 quands left from 0
while(1)
{
my.pan += platform_rotation_speed*time_step;//Rotate platform
car1.pan += car_rotation_speed*time_step;//rotate cars around themselfes
car2.pan += car_rotation_speed*time_step;
car3.pan += car_rotation_speed*time_step;
car4.pan += car_rotation_speed*time_step;
vec_rotate (car1.x,vector(platform_rotation_speed,0,0));//rotate the cars around the vector(0,0,0)
vec_rotate (car2.x,vector(platform_rotation_speed,0,0));
vec_rotate (car3.x,vector(platform_rotation_speed,0,0));
vec_rotate (car4.x,vector(platform_rotation_speed,0,0));
wait(1);
}
}
function main()
{
level_load(NULL);
wait(3);
camera.z = 200;
camera.x = -200;//Move camera
camera.tilt = -45;
ent_create("platform.mdl",vector(0,0,0),platform_action);//create Platform
}