room_height

Note: This function is read-only, you cannot use this function to change the size of the room.

 

This function holds the height of the entire room (you need to use view_hview to get the size of the view inside the room). You can use this in a variety of ways:

 

Example #1

heightofroom = room_height;

 

This will return the height of the room in pixels (480 if it's the default room width)

 

Example #2:

// 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 of the room. You can also use room_height to center objects on screen. First, make sure the origins of the object is in the center then you divide room_height by 2:

 

Example #3

// Create and center the object vertically in the room

instance_create(100,room_height/2,obj_player);

 

Revision #2