YoYo Games Wiki

room_height

From YoYoGames Wiki

Description

(real): the height of the current room

Explanation

This variable holds the height of the entire room (you need to use view_hview to get the size of the view inside the room). This variable is read-only, you cannot use this function to change the size of the room.

Example

// Create an object at the bottom of the room
instance_create(100,room_height,obj_player);

In the example above, as you're using room_height, no matter what size the room is, the object will always be placed at the bottom. You can also use room_hieght to place objects in the middle of the screen. First, make sure the origins of the object is in the center then you divide room_heightby 2:

// Create and center the object horizontally in the room
instance_create(100,room_height,obj_player);

See Also

Content from GMKB, was used to expand this article. The content was contributed by nickydude.