It's late..again. This time the entire programming, audio, graphics departments of SubvertGames were missing...it's not my fault, trust me! Yes, I got flu. ![]() Let's talk about moving between maps. The game world is subdivided in many small maps (up to 256x256 meters per map) because it's the only way to have detailed locations and performance. How things works? We have "Spawn points" and "Portals". A spawn point is nothing special, it's only a placeholder GameObject. Its position and Y-axis rotation will be used to place the player once loaded the new level. ![]() Spawn point A portal is a trigger gameobject created with a simple box collider and two attributes:
![]() A portal! GLaDOS not included. Easy uh? How to keep game state?Loading a new level it's the easy part...but every GameObject will be destroyed when the scene is unloaded. So, how to keep data and game state alive between level changes? This simple script will keep a gameobject from being destroyed on scene change: void Start()
{
DontDestroyOnLoad( this );
}
I started creating an empty GameObject named "_GAME" that uses that script. Then I put every GameObject I want to keep alive between scene change as a child to "_GAME". This way I can store values and GameObjects and be sure they will be still here when loading a new scene. The only drawback is that I was forced to move a lot of code and rethink the connections between gameobjects but being a programmer that was the fun part, or not? :) Extra - Information panelAlso, I started working on interactive objects and the related information panel. This panel will be very useful to show information about objects and other characters. ![]() Information panel ![]() ...and as always...enjoy this week video and remember to subscribe!
|
|||||



