Scope and encapsulation [Game Maker | Most know Basics]
This basics video tutorial shows you what scope and encapsulation mean in GameMaker.
These to interlocking concepts are a must know in GameMaker and generally in programming because all programming languages have them in one way or another. In GameMaker scope is being refered to what instances (and their scripts/functions) can read and override from each other.
The first scope is the default one that all instances have access to each other (instance variables colored in blue or green). These self created variables or pre-set variables shipped with the instance can be accessed and rewritten. The second scope is for local variables (localvariables colored in yellow) that have a limited life time (event, script, function) and are bound to the instance calling it. The third scope is global (global variables colored in purple). These variables are once set static ones and saved in memory, so they don't rely on the instance existence to be access and changed. A sub category of global variables is enums or macro which are one time set and then locked. So you can access them but never change their values.
Tldr:
scope - accessabilty of code/things, which can be normal, local and global
encapsulation - bundling things into a unit, java classes for even hiding /Gamemaker objects, functions
idea is to bundle, hide, seperate interal and external code
Game shown: Nuclear Throne
👑 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 Tldr of scope and encapsulation
1:43 Subscribe
1:53 Introduction
2:30 Things that are encapsulated (here objects)
2:55 Normal cope, instance variables (self made and pre-set)
3:41 Local scope
5:30 Global scope (global, enum, macro)
7:45 Encapsulation for local scope
9:48 Recap