Cheers! That actually worked. Unfortunately now the editor seems to be discriminating me!!!
heres my new code:
==================================================================================
#include <acknex.h>
#include <default.c>
ENTITY* FLOOR;
typedef struct
{
ENTITY* model;
} box;
function new_box()
{
box my_box;
my_box.model = ent_create("cube.x",vector(0,0,0),NULL);
// my_box.model.x = -400;
// my_box.model.y = 0;
my_box.model.tilt = 145;
// my_box.model.z = 2800;
wait(1);
phent_settype (my_box.model, PH_RIGID, PH_BOX); // set the physics entity type
phent_setmass (my_box.model, 3, PH_BOX); // and its mass
phent_setfriction (my_box.model, 80); // set the friction
phent_setdamping (my_box.model, 40, 40); // set the damping
phent_setelasticity (my_box.model, 50, 20); // set the elasticity
}
function main()
{
video_mode=7;
fps_max = 60;
level_load("");
wait(1);
FLOOR = ent_create ("plain3d1.x", vector(-400, 0, -4800), NULL); // create the ball
set(FLOOR,LIGHT);
wait(2);
camera.x = 7500;
camera.y = 250;
camera.z = 1250;
camera.pan = 180;
FLOOR.scale_x=5000;
FLOOR.scale_y=5000;
FLOOR.scale_z=30;
FLOOR.z = -5;
FLOOR.red = 0;
FLOOR.green =0;
FLOOR.blue =0;
FLOOR.ambient = 25;
FLOOR.z=-50;
ph_setgravity (vector(0, 0, -886)); // set the gravity
while (1)
{
// CONTROLS
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
camera.pan -= mouse_force.x * 2;
camera.tilt += mouse_force.y * 2;
if (key_cuu) camera.x -= 252 * time_step;
if (key_cud) camera.x += 252 * time_step;
if (key_cul) camera.y += 252 * time_step;
if (key_cur) camera.y -= 252 * time_step;
if (key_enter) new_box;
//on_e =
wait(1);
}
}
================================================================================
at the "key_enter" part it all goes wrong and gives me that useless "sytax error" again, even though the function works using the commented out "on_e". But i want to make it happen whilst a key is pressed down.... why isn't it working? argh!