3D Going from 3d to 2d freezes game

J

jakekravitss

Guest
I have a 2d game where the main menu is 2d. Clicking "play" goes to a loading screen room and shows a 3d starfield animation for a few seconds. After the few seconds I have it set to go to next room which is 2d. BUT when it does go to the next room, it kind of freezes, nothing on the screen, all black except on android it shows my on screen buttons which do nothing. This code here which is in my starfield object is causing the problem. Removing it fixes the issue but it makes my starfield not look right.

Code:
d3d_start();
d3d_set_lighting(false);
d3d_set_culling(true);
d3d_set_fog(true,c_black,global.fog_near,global.fog_far);
If you want I can post my whole code for the starfield.
 
N

Neurokai

Guest
A friend of mine ran into the same problem. Sprites being all purple-black color. I figured out the problem after starting the debugger and looking at the code. The problem was the lines:
Code:
//set fog
dark_purple=make_color_rgb(27,3,59)
d3d_set_fog(true,dark_purple,16,128)


I am not familiar with anything 3D related in gamemaker, but this caught my eye in an instant That was the EXACT color the sprites went to when going from 3D to 2D... So before entering the next room (going from 3D to 2D) you should disable the d3d fog, as follows:
Code:
d3d_set_fog(false,0,0,0); // disable the fog first, then,
room_goto(room_menu); //goto a menu room
The issue with your code is the same as my friend's, you didn't disable the fog. Which in your case makes everything black, because of this line:
Code:
d3d_set_fog(true,c_black,global.fog_near,global.fog_far);
Which makes everything c_black!

Happy to be of assistance. You're welcome.
 
Top