///////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysx.h>
///////////////////////////////////////////////////////////////////////////////
STRING* map01_str = "map1.wmb";
///////////////////////////////////////////////////////////////////////////////
function main(){
// show all errors:
warn_level = 6;
// limit FPS:
fps_max = 60;
// set video parameters:
video_set(800, 600, 16, 0);
video_aspect = 1.333;
// run physX:
physX_open();
// load the level:
freeze_mode = 1;
level_load(map01_str);
wait(3);
freeze_mode = 0;
}
///////////////////////////////////////////////////////////////////////////////
action hero_act(){
VECTOR temp;
// make me physical object:
pXent_settype(my, PH_CHAR, PH_CAPSULE);
// camera setup:
camera.arc = 80;
// main loop:
while(1){
// gui:
draw_text("press space key to remove objects", 5, 5, COLOR_WHITE);
// move entity:
temp.x = 15 * (key_w - key_s) * time_step;
temp.y = 15 * (key_a - key_d) * time_step;
temp.z = 0;
pXent_move(my, temp, nullvector);
wait(1);
}
}
///////////////////////////////////////////////////////////////////////////////
function ghost_ent(){
// flags:
set(my, PASSABLE | TRANSLUCENT);
// alpha parameters:
my.alpha = 50;
}
///////////////////////////////////////////////////////////////////////////////
action char_act(){
// create passable but visible model, to show you the bbox:
ent_create("bbox.mdl", my.x, ghost_ent);
// make me physical object:
pXent_settype(my, PH_CHAR, PH_CAPSULE);
// wait till space key is pressed:
while(!key_space){ wait(1); }
// unregister object from physX:
for(you = ent_next(NULL); you; you = ent_next(you))
{
if (you != ent_for_name("bbox_mdl_134"))
{
pXent_settype(you,0,0);
}
}
// wait for a while:
wait(-1);
// remove object:
ent_remove(my);
}
///////////////////////////////////////////////////////////////////////////////