#include <acknex.h>
#include <default.c>
ENTITY* blue_tank;
VIEW* camera2 =
{
pos_x = 0;
pos_y = 390;
pos_z = 0;
size_x = 1024;
size_y = 380;
flags = VISIBLE;
}
VIEW* camera1 =
{
pos_x = 0;
pos_y = 0;
pos_z = 0;
size_x = 1024;
size_y = 360;
flags = VISIBLE;
}
action blue_tank()
{
wait(1); c_updatehull(me,0);
while (1)
{
if((my.floor_dist=c_trace(me.x, vector(me.x,me.y,me.z-100), IGNORE_ME|USE_POLYGON)))
{ my.z -= my.floor_dist+my.min_z; } //crude gravity/floor-matching code
if (key_a)
my.pan += 3*time_step; // increase the pan angle of the car
if (key_d)
my.pan -= 3*time_step; // decrease the pan angle of the car
if (key_w )
c_move (my, vector(2*time_step, 0, 0), nullvector, GLIDE);
if (key_s )
c_move (my, vector(-2*time_step, 0, 0), nullvector, GLIDE);
wait (1);
vec_set(camera1.x,my.x);
vec_set(camera1.y,my.y);
vec_set(camera1.z,my.z-2);
vec_set(camera1.pan,my.pan);
}
}
action red_tank()
{
wait(1); c_updatehull(me,0);
while (1)
{
if((my.floor_dist=c_trace(me.x, vector(me.x,me.y,me.z-100), IGNORE_ME|USE_POLYGON)))
{ my.z -= my.floor_dist+my.min_z; } //crude gravity/floor-matching code
if (key_j)
my.pan += 3*time_step; // increase the pan angle of the car
if (key_l )
my.pan -= 3*time_step; // decrease the pan angle of the car
if (key_i )
c_move (my, vector(2*time_step, 0, 0), nullvector, GLIDE);
if (key_k )
c_move (my, vector(-2*time_step, 0, 0), nullvector, GLIDE);
wait (1);
vec_set(camera2.x,my.x);
vec_set(camera2.y,my.y);
vec_set(camera2.z,my.z-2);
vec_set(camera2.pan,my.pan);
}
}
function main()
{
level_load ("tmap.wmb");
wait (1);
ent_create("blue_tank.mdl", vector(-460, 460,10),blue_tank);
ent_create("red_tank.mdl", vector(460, -460,10),red_tank);
}
function init_startup()
{
wait (-1);
video_switch(8, 0, 0); // change the resolution to 1024 x 768 pixels
camera.flags &= ~VISIBLE; // now hide the default camera
// set the desired positions and angles for the 4 cameras
// settings for camera 2
vec_set (camera2.x, vector (0,0,0));
camera2.pan = 0;
camera2.tilt = 0;
camera2.roll = 0;
vec_set (camera1.x, vector (0,0,0));
camera1.pan = 0;
camera1.tilt = 0;
camera1.roll = 0;
}