I started making another smaller game project which is called Brache where i wanted to learn how to faster make a 2D matrix system of a map system based off scenes with the same width and height.

A small gif of the programmed menu animation.

A W.I.P (Work in progress) video of the game project.

Turnaround render of one of the Mech enemies in Brache.

 

All layouts are 1920×1080 and calculates what x,y point the player goes at the edge of a layout screen and respawn the player avatar at the same place on another layout. For example if the player goes on the right X axis he respawns on the left X axis on another layout with the same Y height Axis (written in blue text in the picture underneath) on both layouts same goes in the opposite direction.

If the player falls down the player spawns on the upper part with the same X axis (also written in blue in the picture underneath) on another layout. Or the opposite way around if the player goes at top edge of a layout to then respawn on the bottom of another layout.maparray-code-visualization

All the layouts have a naming convention of “layout (X value) and (Y value)” and through 4 lines of code adding or subtracting from a global X or Y variable depending on the direction of exiting screens as described above. The game then knows through a 5th line of code what layout to load where the avatar needs to respawn inside all depending on the values of these global X,Y variables.

I then also applied this to a global 2D array and continue to apply that over to a spritesheet with X,Y instance variable telling if the parts of the map should be visible or invisible when loading the map layout. The map layout is where the sprite parts for the map resides and can be seen in the video updating the location of the avatar and where it has been. I made this code check through a for loop so everytime the map layout loads it rechecks all 510 sprites which has been visited or not.