Jump to content

Map tutorial: Difference between revisions

From n-gon Wiki
No edit summary
m Adricheeks moved page Map making guide to Map-tutorial: official name
(No difference)

Revision as of 13:17, 4 March 2025

The map-tutorial is a map-making guide by 3xionDev that is part of the n-docs repository. Maps are a large part of the n-gon modding community. They aren't too hard to make, it just takes some time.If you want to get into modding n-gon, then the n-docs is a great place to start.

Starting with an Empty Map

If you want a completely blank map to build your own map from scratch, then you will need a copy of n-gon and a way to edit the .js files. Download a copy of the game from the GitHub page and open a text-editor or an IDE.

Open the main copy you downloaded onto the text editor and enter the folder titled "js." Locate "level.js" and open it. Find the code snippet that says template() { which should be around line 2101. Replace "template" with the desired level name.

Find the line level[simulation,is training ? "walk" : "initial"]() around line 73. Replace "initial" with what you want to name your level. This will force the game to boot into your level instead of the starting room.

Basic Map Creation

To make a map, you need to have testing mode and construct mode unlocked. To do this, open your browsers JavaScript console and type in the commands lore.unlockTesting() and simulation.enableConstructMode(). Press T while in-game to open the testing/construct mode overlay. Refer to the testing mode page to learn more about the controls.

While on a map, hold the mouse down and drag to draw the map. Right click and drag to create blocks. There is an invisible grid that keeps all of the aspects of a map in place. If it seems your placement of map/blocks is inaccurate or offset, there is nothing wrong, its just the map/blocks snapping to the grid. Press the center mouse button (or click the scroll wheel) to create a mob spawn.

While in construct mode, there will be a white box in the bottom right corner of the screen that displays the code for each thing you add to the level. Press Ctrl + A to select the text, and Ctrl + C to copy it.

Changing Level Exit/Spawn

Find the coordinates of where you want the level exit/spawn to be, and copy them down somewhere

Changing Level Spawn: Find the line level.setPosToSpawn(0, -50); in the function that defines your level and change 0 to the first (x) value of the coordinates you recorded and change -50 to the second (y) value that you recorded. Reload the page and re-enable construct mode. The spawn will be in the position you selected.

Changing Level Exit: Record the desired coordinates, find the line level.exit.x = 1500; in your level function, and replace the value with your desired x value. Just below that there's another line called level.exit.y = -1875; Replace the value with your desired y value. Upon reloading and re-enabling construct mode, the exit will be in the desired position.

Inserting Level Code

After finishing your level, copy all of the level code into your clipboard. Go back to the level function (where template() { before you renamed it) in level.js. Find the line level.customTopLayer = () => { }; and paste your level code underneath it. Make sure the code is aligned with the proper indentation, or some things could break.


This tutorial was ripped directly from 3xiondev's map tutorial, found here.