|
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible),
637
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
HELP!!! Lite-C Free crashes on load..
#253342
02/24/09 07:00
02/24/09 07:00
|
Joined: Feb 2009
Posts: 6 Makati, PH
bubu_mouse
OP
Newbie
|
OP
Newbie
Joined: Feb 2009
Posts: 6
Makati, PH
|
i need help..my lite-c free crashes on load.. i tried commenting out parts of my code and it seems that this code causes it to crash.. ENTITY* player = { type = "orc.mdl"; flags = SHOW; x = -265; y = 220; z = FLOOR; } btw..here's all of my code..please help..thanks much! /////////////////////////////////////////////////////////////// #include <acknex.h> ///////////////////////////////////////////////////////////////
//player state #define INACTIVE 1 #define STAND 0 #define RUN 1 #define TURN 2
//global variables var animatepercent = 0; var state = -1; var direction = 0;
//define keys var UP_KEY=17; // key_w var DOWN_KEY=31; // key_s var LEFT_KEY=30; // key_a var RIGHT_KEY=32; // key_d
//camera offsets #define FLOOR -22 #define CAM_DIST 50 #define CAM_HEIGHT 40 #define CAM_TILT -30
//character offsets #define char_speed 7 #define char_size 1.5
ENTITY* player = { type = "orc.mdl"; flags = SHOW; x = -265; y = 220; z = FLOOR; }
function camera_update(){ camera.x = my.x - cos(my.pan) * CAM_DIST; camera.y = my.y - sin(my.pan) * CAM_DIST; camera.pan = (my.pan); camera.z = CAM_HEIGHT; camera.tilt = CAM_TILT; }
function player_update(){ my.z = FLOOR; if (state == STAND){ animatepercent += time_step; ent_animate(me, "stand", animatepercent, ANM_CYCLE); } if (state == RUN){ animatepercent +=char_speed*time_step; ent_animate(me, "run", animatepercent, ANM_CYCLE); c_move(me, vector(char_speed*(key_w-key_s)*time_step,0,0),nullvector, GLIDE); camera_update(); } if (state == TURN){ my.pan += 5*(key_a-key_d)*time_step; camera_update(); } }
action player_move(){ while(1) { if(key_pressed(UP_KEY) == ON){ state = RUN; player_update(); } else{ state = STAND; player_update(); } if(key_pressed(RIGHT_KEY) == ON){ state = TURN; player_update(); } if(key_pressed(LEFT_KEY) == ON){ state = TURN; player_update(); } if(key_pressed(DOWN_KEY) == ON){ state = RUN; player_update(); } wait(1); } }
void main(){
fps_max = 140; level_load("maze.wmb"); wait(1); player = ent_create("orc.mdl", vector(-265,220,FLOOR), player_move); set(player, SHADOW); player.scale_x = char_size; player.scale_y = char_size; player.scale_z = char_size; camera.x = player.x - cos(player.pan) * CAM_DIST; camera.y = player.y - sin(player.pan) * CAM_DIST; camera.pan = player.pan; camera.z = CAM_HEIGHT; camera.tilt = CAM_TILT; }
|
|
|
Re: HELP!!! Lite-C Free crashes on load..
[Re: Xarthor]
#253349
02/24/09 08:01
02/24/09 08:01
|
Joined: Dec 2008
Posts: 271
Saturnus
Member
|
Member
Joined: Dec 2008
Posts: 271
|
And BTW defines don't work in definitions of engine objects: #defines are valid within all subsequent code, but ignored within engine objects definitions, such as PANEL*, MATERIAL* etc. sourcePerhaps this can cause a crash, too.
|
|
|
|