Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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
B
bubu_mouse Offline OP
Newbie
bubu_mouse  Offline OP
Newbie
B

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..

Quote:
ENTITY* player = {
type = "orc.mdl";
flags = SHOW;
x = -265;
y = 220;
z = FLOOR;
}


btw..here's all of my code..please help..thanks much!

Quote:
///////////////////////////////////////////////////////////////
#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: bubu_mouse] #253343
02/24/09 07:13
02/24/09 07:13
Joined: Feb 2009
Posts: 6
Makati, PH
B
bubu_mouse Offline OP
Newbie
bubu_mouse  Offline OP
Newbie
B

Joined: Feb 2009
Posts: 6
Makati, PH
i don't get it..i removed the ENTITY* declaration then it worked out fine..
does it mean that ENTITY* is the same as ent_create() ? please enlighten me.. thanks very much!

Re: HELP!!! Lite-C Free crashes on load.. [Re: bubu_mouse] #253346
02/24/09 07:45
02/24/09 07:45
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
No.
ENTITY* player = { bla } is a definition of a VIEW entity. (lives on the screen, has no collision, automaticly attached to the camera etc.)

ent_create creates a WORLD entity, which is exactly what you wanted.

Re: HELP!!! Lite-C Free crashes on load.. [Re: Xarthor] #253348
02/24/09 07:58
02/24/09 07:58
Joined: Feb 2009
Posts: 6
Makati, PH
B
bubu_mouse Offline OP
Newbie
bubu_mouse  Offline OP
Newbie
B

Joined: Feb 2009
Posts: 6
Makati, PH
i see.. thanks so much sir Xathor!

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 Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
And BTW defines don't work in definitions of engine objects:
Quote:
#defines are valid within all subsequent code, but ignored within engine objects definitions, such as PANEL*, MATERIAL* etc.
source

Perhaps this can cause a crash, too.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1