room_set_view(ind, vind, vis, xview, yview, wview, hview, xport, yport, wport, hport, hborder, vborder, hspeed, vspeed, obj);
Argument | Description |
---|---|
ind | The index of the room to set the view of. |
vind | The view 'slot' to set, between 0 and 7. |
vis | Whether the view is visible (true) or not (false). |
xview | The x position of the left of the area the view captures. |
yview | The y position of the top of the area the view captures. |
wview | The width of the area the view captures. |
hview | The height of the area the view captures. |
xport | The x position of the left of the area the view occupies on-screen. |
yport | The y position of the top of the area the view occupies on-screen. |
wport | The width of the area the view occupies on-screen. |
hport | The height of the area the view occupies on-screen. |
hborder | The minimum horizontal space between the edge of the view and the object it is set to follow (before the view begins moving and if it is set to follow an object). |
vborder | The minimum vertical space between the edge of the view and the object it is set to follow (before the view begins moving and if it is set to follow an object). |
hspeed | The maximum horizontal speed the view can move at. |
vspeed | The maximum vertical speed the view can move at. |
obj | The object or instance to follow. -1 to disable object following. |
Returns: N/A
This function can be used to define a view within any room in
your game except the current one. The code will replicate
all the same options that are available within the room editor.
global.myroom = room_add();
room_set_view(global.myroom, 0, 1, 0, 0, 320, 240, 0, 0, 640, 480,
64, 64, 4, 4, obj_player);
This will set view[0] in global.myroom. It will make the view visible with an initial position of (0,0) and a width and height of (320, 240) but will display it double-size as the view port has been set to 640x480. It will also set the view to keep 64 pixels horizontally either way, and 64 pixels vertically either way, between its edges and the player and it will have a maximum horizontal and vertical speed of 4 pixels per second.