NimonoSolenze
Member
Hi, I'm trying to figure out how to make a camera change from its default position when warping to another room, in the destination room, but after a glance at the documentation, I must be misunderstanding something, because my code isn't working as I intend. Here is my code:
It's a Zelda-style game with 'screens' that are all on a single room, 304x304 in size, so I lock it to those dimensions and positions. Yet for some reason, when those code runs... Nothing is changed. The player starts again at the destination's default camera location, every single time. I don't understand what I am doing wrong; the only thing I've learned is that viewport 0 in this code......does not appear to be THE viewport 0 for the room, which baffles me. If I check the value of the view's X and Y after setting it in that code....it's still 0, 0 instead of the intended 0, 304 (I have the test warp warp me to the next "room" to the south, which will put the camera at 304y). What am I doing wrong? Am I completely misunderstanding how these functions work? Do these not work with the default cameras? Are these solely for creating cameras and viewports from scratch, not meant to be used in conjunction with editor-made viewports and cameras? Please, I'd like some help understanding this!
Code:
var vals = room_get_viewport(warpTo, 0);
room_set_camera(warpTo, 0, 0);
room_set_viewport(warpTo, 0, vals[0], (warpX div 304) * 304, (warpY div 304) * 304, vals[3], vals[4]);
var pl = room_instance_add(warpTo, warpX, warpY, obj_player);
room_goto(warpTo);