TheMagician
Member
I want to create a camera which I then assign to a viewport in the current room as well as a viewport in another room (basically I want to set up the viewports in all rooms at the beginning of the game). I don't use any of the view checkboxes in the Room Editor.
Here's the code in the Create Event of the camera object in the first room:
Whenever I switch to the other room the game crashes. What am I doing wrong?
Additional Information: If I leave out this line:
then I get a scrambled view in the current room (which is expected because I don't assign a camera to its viewport) but switching to the other room now produces the correct result (no crash and correct camera assignment).
Here's the code in the Create Event of the camera object in the first room:
Code:
//create camera
//====================
cam = camera_create_view(0,0,800,480,0,-1,-1,-1,0,0);
//setup view in current room
//====================
view_enabled = true;
view_visible[0] = true;
view_set_wport(0,800);
view_set_hport(0,480);
view_set_camera(0,cam);
//setup view in other room
//====================
room_set_view_enabled(rm_other,true);
room_set_viewport(rm_other,0,true,0,0,800,480);
room_set_camera(rm_other,0,cam);
Additional Information: If I leave out this line:
Code:
view_set_camera(0,cam);