///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
ENTITY* arm;
ENTITY* door;
BMAP* control ="controls.bmp";
var shoot_percentage;
STRING* gameover = "GAME OVER!!";
var trigx;
var trigy;
var blocktrigx;
var blocktrigy;
var traced;
ENTITY* trig1;///Openx entity
ENTITY* trig2;///Openx2 entity
ENTITY* trig3;///openy entity
ENTITY* trig4;///openy2
void make_player();
PANEL* gameover_pan =
{
digits = (450, 300,"Press C to close" , "Arial#24d", 1, gameover);
}
function main()
{
max_entities = 9000;////Enable up to 2000 Entities
video_mode = 7;
level_load ("scifi_1.wmb");
wait (2); // wait until the level is loaded
arm = ent_create ("handgloc.mdl", vector(-768.000, -112.000, -272.000), make_player);
}
action door_open()
{
door = me;
}
void gun_blowback()
{
while (shoot_percentage < 100.0001){
ent_animate(arm,"shoot",shoot_percentage, 0);
shoot_percentage += 1.6 * time_step; wait(1);}
}
void option_panel();
void make_player()
{
arm = me;
while (1)
{
trigx = my.x;
trigy = my.y;
camera.x = arm.x;
camera.y = arm.y;
camera.z = arm.z + 3;
camera.pan = arm.pan;
camera.tilt = arm.tilt;
arm.z = -320.500;
if (key_w)
c_move (arm, vector(10 * time_step, 0, 0), nullvector,IGNORE_PASSABLE);
if (key_s) c_move (my, vector(-5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE);
arm.pan -= 8 * mouse_force.x * time_step;
arm.tilt += 8 * mouse_force.y * time_step;
arm.tilt = clamp (arm.tilt,-40, 20);
if (mouse_left) {shoot_percentage = 0; gun_blowback();}
option_panel();
c_setminmax(me);
vec_set(my.min_x,vector(-29,-23,-40));
vec_set(my.max_x,vector(29,23,40));
wait (1);
}
}
///////ALL LINES BELOW HERE!
PANEL* controls_pan =
{
bmap = "control";
pos_x = 187;
pos_y = 97;
}
void option_panel()
{
if (key_f8){
controls_pan.flags =TRANSLUCENT | VISIBLE;
}
else
{
controls_pan.flags = NULL;
}
}
action openy2()
{
trig4 = me;
}
action openx()
{
trig1 = me;
while(door.z > -572.000){
if ((arm.x < my.x) && (arm.x > trig2.x) && (arm.y < trig1.y) && (arm.y > trig2.y))
if (key_o){ set(gameover_pan,INVISIBLE);
while(door.z > -572.000)
{
door.z -= .5; wait(1);
}
}
wait(1);
}
}
action openx2()
{
trig2 = me;
}
action openy()
{
trig3 = me;
}