1 registered members (AndrewAMD),
1,014
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Level load problem
#258588
03/31/09 18:21
03/31/09 18:21
|
Joined: Mar 2009
Posts: 88
Walori
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2009
Posts: 88
|
Greetings all, it was about time I have to ask, and post, to these forums. My problem is maybe a simple one with better GS versions but in Lite-C I use (well, I do have 30d trial, but I can't count on that because I can't be too dependented of it when trial ends.) I have tried to attach my = NULL; to the functions without succes. Basicly I'm looking a way to load a level, from one file to another so that the functions don't give you a error message. Here's some things I've done, and how the code works. //////////////////////////////
// Create player model by gendre
//////////////////////////////
switch (player_gendreC){
case 1:
player_warrior = ent_create("Data/Models/army.mdl",vector(223,-1105,0),NULL);
player = player_warrior;
break;
case 2:
player_warrior = ent_create("Data/Models/soldat.mdl",vector(223,-1105,0),NULL);
player = player_warrior;
break;
default://Create female model by default (No difference yet!)
player_warrior = ent_create("Data/Models/army.mdl",vector(223,-1105,0),NULL);
player = player_warrior;
break;
}
//////////////////////////////
// Set player UI and all the neccesaery stuff
//////////////////////////////
player_ui_mana_pan.flags = VISIBLE;
player_ui_health_pan.flags = VISIBLE;
wait(1);
player.pan = 0;
melee_model(NULL);
shield_model(NULL);
ent_create (shield_mdl, player.x+9, move_shield);
ent_create (melee_mdl, player.x+9, move_melee);
pSpell =ent_create("", vector(0,0,-10000),0);//Create dummy spell to the field
wait(1);
ptr_remove(pSpell);//And remove dummy spell
wait(1);
//vec_set(mouse_pos.x,mouse_cursor.x);
//vec_set(mouse_pos.y,mouse_cursor.y);
mouse_pointer = 1;
//////////////////////////////
// Main loop
//////////////////////////////
while(player !=NULL){
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
if(key_f2){
//player = NULL;
//level_load("Data/Maps/02/demo_level.wmb");
}
//////////////////////////////
// Load functions
//////////////////////////////
controls();
player_gravity();
calc_player_stats();
... That's the game void I'm using to handle the basics of the game, character creations, spell system and so forth. Everything works from this file, saved as game.c to my hard drive. function controls(){
var dummy_alive = 0;
if(mouse == 0){
//////////////////////////////
// General movement
//////////////////////////////
if(key_pressed(282) == ON){
mouse = 1;
}
if (key_w)
c_move(player, vector(5*time_step,0,0),nullvector, GLIDE);
if (key_s)
c_move(player, vector(-5*time_step,0,0),nullvector, GLIDE);
if(key_a)
c_move(player, vector(0,5*time_step,0),nullvector, GLIDE);
if(key_d)
c_move(player, vector(0,-5*time_step,0),nullvector, GLIDE);
if((key_shift) && (key_w))
c_move(player, vector(7*time_step,0,0),nullvector, GLIDE);
if(key_f2){
lvl_load = 1
//level_load("Data/Maps/02/demo_level.wmb");
}
if((key_pressed(57)) == ON ){
c_move(player, vector(0,0,67*time_step),nullvector, GLIDE);
wait(1);
}
//////////////////////////////
// Special commands
//////////////////////////////
if(key_f4){
printC_game_info_pan.flags = VISIBLE;
k_pan.flags = VISIBLE;
//set(printC_game_info_pan, VISIBLE);
//set(k_pan, VISIBLE);
... And here we have a glance to a file that causes one of the problems: controls.c, basicly I've made "player" (defined earlier in void game) and move it, I haven't used any my, or me because I can't attach these to the player from WED when the trial ends (afaik) So if I want to load let's say from map1.hmp to level1.wmb what should I put to these files? Or do I have to take a risk and attach these from WED (as action right?). I'd rather use this format though. Thanks in advance, Walori
|
|
|
Re: Level load problem
[Re: Walori]
#258805
04/02/09 09:09
04/02/09 09:09
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
why you can't put hmp in wmb and load only wmb files in whole project? Will be easier for you
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
|