1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Level Loading
#345017
10/22/10 17:11
10/22/10 17:11
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
My game now has a menu and a working "New Game" button. When this button is pressed, the game loads my test level, but it creates some weird problems. First of all, the lighting is a bit messed up. My map's lighting is supposed to be dark blue, but when I load this level through the menu, the blue is a lot lighter. Also, some weird, giant, red block appears at the start of the level. Here's the code for loading the level:
vec_set(sky_color,vector(180,130,40));
level_load("testlevel.wmb");
skybox = ent_createlayer("cityskylinebig.tga", SKY|CUBE|SHOW, 0);
snd_stop(musichandle);
SOUND* music = "SONG2.wav";
musichandle = snd_loop(music,80,0);
menu = 0;
gamemenu = 1;
game_save("restart",1,SV_ALL);
It's basically the same way the menu level is loaded, but the there's code that changes the music, switches some variables, and saves the game, so restarting the level is possible (although, I'm guessing this is inefficient :P). Anyone know what's causing the level loading to mess up?
|
|
|
Re: Level Loading
[Re: Pappenheimer]
#345628
10/27/10 23:36
10/27/10 23:36
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
Some questions: - why do you set the skycolor, when you create a skycube anyway? - why do you use game_save, when the level is just loaded? - What happens, when you don't set a skycolor, and don't create a skycube? Sorry for the late reply! D: 1. Good question... 2. I use game_load to restart the level when Restart Level is pressed. I'll probably change this to loading the level properly, but for now I haven't set up a variable to tell the game what level it should be at. 3. Taking out the skybox, and sky color did not seem to affect anything, but, I tried taking out the skybox from the function main, and from the level loading code, and the huge red block disappeared (which I noticed has some other colored parts, and might be my character's model). The lighting continued to stay messed up though.
|
|
|
Re: Level Loading
[Re: Valdsator]
#345629
10/27/10 23:58
10/27/10 23:58
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
i always had problems with ent_createlayer before calling level_load, remove ent view entities (those created by ent_createlayer) and hopefully will solve your problem.
ent_remove(skybox);
level_load("testlevel.wmb");
|
|
|
Re: Level Loading
[Re: Valdsator]
#345988
10/31/10 03:08
10/31/10 03:08
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
Bump. Still need help with the lighting problem! Edit: I think I should give a bit more information about this problem. Here's a picture of how it looks after loading the level from the menu, how it should look (achieved by loading the level from the script), and what the menu lighting looks like, which is basically the same as how the 1st level's lighting should be. Edit 2: Alright, after doing some testing that I should have done earlier, I've realized that the second level is taking the first level's light settings, and then mixing it's own light settings. I'm guessing I simply need to reset the light at the start of the level, somehow. But, I don't know how to do this. Help?
Last edited by Valdsator; 11/02/10 03:24.
|
|
|
Re: Level Loading
[Re: Valdsator]
#346373
11/04/10 21:37
11/04/10 21:37
|
Joined: Mar 2009
Posts: 186
Valdsator
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 186
|
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|