///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlView.c>
#define STATE skill1
#define ANIMATION skill2
#define CREATOR skill3
#define HEALTH skill4
#define DAMAGE skill5
///////////////////////////////
....
PANEL* first_pan =
{
pos_x = 1077;
pos_y = 949;
layer = 1;
bmap = healthbarframe_bmp;
flags = OVERLAY | SHOW;
}
PANEL* second_pan =
{
window (1080, 949, 65, 25, "healthbar.bmp", player.skill4, 0);
flags = SHOW;
}
PANEL* third_pan =
{
digits (1100, 930, 3, "Arial#15b", 0.667, player.skill4);
flags = SHOW | OUTLINE;
}
....
///////////////////////////// Gravity /////////////////
function handle_gravity()
{
result = c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_PASSABLE|IGNORE_MODELS|USE_BOX);
if (key_ctrl)
{
if(result > 6)
{
if (result > 400)
{
player.skill4 -= result/80; //ignore this lame fall damage code :P
if (player.skill4 <= 0)
{
my.ANIMATION = 0;
my.STATE = 4; // 4 = dead
}
}
absdist.z -= 1.5 * time_step;
}
else
{
if (result <= 4)
{
if (absdist.z < 1) absdist.z += 1 * time_step;
}
else
{
absdist.z = 0;
}
}
}
else
{
if(result > 12)
{
if (result > 400)
{
player.skill4 -= result/80; //ignore this lame fall damage code :P
if (player.skill4 <= 0)
{
my.ANIMATION = 0;
my.STATE = 4; // 4 = dead
}
}
absdist.z -= 2 * time_step;
}
else
{
if (result <= 10)
{
if (absdist.z < 1) absdist.z += 1 * time_step;
}
else
{
absdist.z = 0;
}
}
}
}
....
function main()
{
....
while (1)
{
....
if (player.skill4 > 0) {camera.pan -= mouse_force.x * (8 * time_step);}
}
if (player.skill4 > 0)
{
camera.tilt += mouse_force.y * (8 * time_step);
camera.tilt = clamp(camera.tilt,-50,50);
....
if (mana < 150 + (energy * 15))
mana += 0.07 + (energy * 0.01);
if (player.skill4 < 150 + (vitality * 15))
player.skill4 += 0.03 + (vitality * 0.01);
if (mana > 150 + (energy * 15))
mana -= 0.05;
if (player.skill4 > 150 + (vitality * 15))
player.skill4 -= 0.05;
}
wait (1);
}
}
....
// hit event
function wizard_hit()
{
if (my.STATE != 4)
{
player.skill4 -= you.DAMAGE;
if (player.skill4 <= 0)
{
my.ANIMATION = 0;
my.STATE = 4; // 4 = dead
}
}
}
....
action wizard_walk()
{
player = my;
camera_follow(me);
camera.genius = my;
camera.arc = 80;
....