Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

GMRoomPack

Package GameMaker rooms and load them as you please · By YellowAfterlife

How to get the size of an exported room?

A topic by moppin created Dec 16, 2019 Views: 299 Replies: 3
Viewing posts 1 to 4

Hi, I feel like I must be missing something here but I can't figure out how to get the width / length of a specific "packed" room. I need the room size info to offset them accordingly with their size. Is there a way?

Developer

Since packed rooms are just JSON, you can output json_encode of a room (maybe prettify it too) and see where the width/height fields are (either in root or sub-object, depending on whether you use GMS1 or GMS2)

Ahh I see, thanks for the explanation! I'm new to the whole JSON stuff so I don't fully understand it yet but I think I managed to figure out how to get the room width thanks to your explanation - I would just like your input on if the following is a decent enough way to go about it?

var json = scrPackedRoom00()
packedRoomWidth = ds_map_find_value(ds_map_find_value(json,"roomSettings"),"Width")

Never mind, I have further figured out that these JSONs basically have ds_maps and ds_lists nested inside and I just have to dig through them to find a specific value. Now that this is solved this extension is super useful to me! Thank you so much for making it!