Enter building - remove roof (culling) [Game Maker | Basics]
This basics video tutorial shows you how to disable/turn off/make invisible a roof when the player is entering a building in GameMaker.
The idea is quite simple. You use two tilesets layers (or more) that are being switched off and on. That you do by layer_set_visible. You can achieve that by having an object as a trigger plate and when the player walks over it (collision check) then turn the tile layer that should be visible on and the other one off. That's it!
Note that you cannot set any layer to an alpha value, only visible or invisible are currently possible. As an alternative you can use instances with sprites and fade them out and in but this method is quite specific. It requires for each roof a different sprite (if they have have different sizes).
Tldr:
toggle tile layers off/on
have a trigger plate instance to set visibility
👑 Support me and get fresh game art and game maker projects every month:
https://www.patreon.com/1upindie
Follow me on:
📸 Instangram: https://www.instagram.com/1upindie
🐦 Twitter: https://twitter.com/1upIndie
💬 Discord: https://discord.gg/gvr98nb
📜 Udemy: https://www.udemy.com/course/become-a-video-game-developer-with-gms-23/ (See youtube about page for discount)
CHAPTERS
-------------------------------------------------------------------------------------------------------
0:00 What we will do
0:42 Subscribe
0:57 Loop player's alarm and toggle layers visibility off/on
2:35 Grab the tileset layer ids
4:05 Is the player colliding/walking over the trigger instances?
4:32 Is the player not inside the building, toggle interior layer off and exterior on
5:06 Is the player inside the building, toggle interior layer onand exterior off
6:32 Optional: How to make a "transparent" building/roof