Code Editing

Code-Editing is adding items/features into a Super Mario Flash and/or Super Mario Flash 2 level, which usually cannot be made directly from the Level Editor, by means of editing the Level Code manually in text form. Using Code-Editing, a user can for example add hidden sprites and tiles into their level, change Mario's physics, alter warps, and more.
==Code Editing in MSupera==
==.==
==Code Editing in Super Mario Flash 2==
In Super Mario Flash 2, you can do a lot of different things with Code-Editing.
===Hidden Items===
Tiles/sprites can be replaced with Code-Editing only tiles/sprites. You can for example swap a still Mushroom out of a ?-Block with a Text Box. Here are some simple steps on how to do this:
*Step 1: Put the tile where you want your Code-Edit sprite. NOTE: you must know the ID of the tile. It is recommended to use a Text Box (ID = 67), as this is one of the least used tiles in levels.
*Step 2: Copy your code, and paste it in Word, or, if using a Macintosh, TextEdit.
*Step 3: Use Word's searchbar (ctrl + F) and look for the tile's ID you want to swap your Code-Edit sprite with. If you used a Text Box for example, look for the number 67.
*Step 4: Replace the number with the Code-Edit sprite's ID (if using large quantities of the sprite, it is reccommended to use find-and-replace functionality).
*Step 5: Copy your level code, paste it into Super Mario Flash 2, and there you go!
Here is a list of Code-Edit sprites. An asterix * means it does not have a sprite coded for the level editor, and will cycle through several sprites before stabilizing as the Spinner sprite:
Sprite 	ID 	Notes
Super Mushroom* 	303	This Mushroom doesn't move.
Fire Flower* 	304	
Cape Feather* 	305	The feather will fall down normally.
Starman* 	306	Will move normally.
Brick Block Star 	390	
Brick Block Yoshi 	391	
Brick Block Vine 	392	
Yoshi 	300	By himelf.
Egg* 	333	A Yoshi will grow out of this egg.
Door 	248	This door does not function as a warp and acts as a background tile, making it usable as scenery.
P-Switch Door 	249	This door is does not function as  warp and acts as a background tile, making it usable as scenery, but still only appears when a P-Switch is active.
Goal Gate Tile 	240	Used for scenery. The light blue goal gate tile is not known to exist as a tile.
Goal Gate Top 	239	Used for scenery. The light blue goal gate tile is not know to exist as a tile.
Dark blue Checkpoint Tile 	261	Used for scenery.
Dark blue Checkpoint Top 	260	Used for scenery.
Light blue Checkpoint Tile	259	Used for scenery.
Light blue Checkpoint Top 	258	Used for scenery.
Mounty Mole Hole 	3 	This behaves as a coin and will disappear upon pickup. Also used for scenery.
Invinsible Death Tile 	46 	 Behaves the same way as lava, causing Mario to lose a life and destroying any sprite upon contact.
Bowser* 	383	Should be placed 9 tiles above the ground so that Bowser's second and third phases interact with the ground correctly. If the area Bowser is in is not meant to scroll horizontally, Bowser should also be placed 4 tiles away from the right border of the screen.
===Mario's Physics===
:See also: Mario Physics in SMF2
By changing the 3rd number in a Super Mario Flash 2 level code, you can change Mario's physics. Why is this feature in the game? Pouetpu may have used this for testing purposes, or for Mario to change it's physics when it obtains a power-up and uses it. The default is always 0 upon creating a new level.
Physic 	ID	Notes
Invincible Super Mario 	1 	
Invincible Fire Mario 	2 	
Invincible Cape Mario 	3 	
Cape Glitch Mario 	4 	Mario can go through the ground when holding down while in this state.
Glitched Dancing Super Mario 	5 	
Glitched Dancing Fire Mario 	6 	
Glitched Dancing Cape Mario 	7 	
Climbing Mario 	10	
Invincible Climbing Super Mario	11	
Invincible Climbing Fire Mario 	12	
Invincible Climbing Cape Mario 	13	
Holding/Zombie Mario 	15	In this state, Mario won't be able to pick up anything or use an Inventory Item.
Holding/Zombie Super Mario 	16	In this state, Mario won't be able to pick up anything or use an Inventory Item.
Holding/Zombie Fire Mario 	17	In this state, Mario won't be able to pick up anything or use an Inventory Item.
Holding/Zombie Cape Mario 	18	In this state, Mario won't be able to pick up anything or use an Inventory Item.
Invincible Swimming Mario 	25	
Invincible Swimming Super Mario	26	
Invincible Swimming Fire Mario 	27	
Invincible Swimming Cape Mario 	28	
Flying/Ninja Mario 	50	In this state, upon level start Mario will fly to the right in his sprite used when climbing a ramp. Colloquially described as a "ninja kick."
===Exceeding the Limit===
In normal Super Mario Flash 2, there is a X & Y limit (9990X/y). But, it is possible to bypass this limit by Code-Editing. Follow these steps to learn how to do it. Note: you can do the steps only with either the X or Y axis, if you do both, the game will freeze upon level code input.
*Step 1: Create a new level (blank level) and copy the level code.
*Step 2: Paste the level code in a text editor program like Word or Notepad
*Step 3: Duplicate the L1 & L2 Axis number and also the L1 & L2 part of the level code. Note: make sure you don't copy the '&' in the level code!
*Step 4: Past in your new level code in the game and enjoy your large level!
You can even repeat the above steps to get an even longer level! But be careful, as that level may exceed the character limit of the Level Portal, which is 200,000 characters.
===Hidden Music===
By changing the second number in a Super Mario Flash 2 level code, you can change the music.
*Changing the number to 18 will cause the level to have the Key-exit music.
*Changing the number to any number apart from 1 to 18 will cause the level to have no music. The number can also have non-numeric characters, in which case there will also be no music and the music number will be displayed as "NaN" in the Level Editor.
=== Warp Editing ===
Within the level's code, all of the level's entrances and all of the level's exits have their own sections, making two sections of warp data. For both entrances and exits, each warp is represented by four values.
==== Entrances ====
===== Value 1 (Entrance Type) =====
#	Description
0	Mario spawns. There is no animation.
1	Mario spawns, and then repeatedly enters a door (regardless of whether a door is present) infinitely.
2	Mario exits a pipe upwards.
3	Mario exits a pipe downwards.
4	Mario exits a pipe upwards, but instead of the player gaining control, the animation resets and continues infinitely.
5	Mario exits a pipe downwards, but instead of the player gaining control, the animation resets and continues infinitely.
6	Mario exits a pipe walking to the left, facing the direction determined by value 4.
7	Mario exits a pipe walking to the right, facing the direction determined by value 4.
8	Mario exits a pipe walking to the right facing the direction determined by value 4, but instead of the player gaining control, the animation resets and continues infinitely.
9	Mario exits a pipe walking to the left facing the direction determined by value 4, but instead of the player gaining control, the animation resets and continues infinitely.
Because the only entrance types that cannot be placed directly via the level editor cause the level to soft-lock, altering this value has no practical applications.
===== Value 2 (X Position) =====
The value determines how far from the leftmost space in the level the entrance is, with 20 representing one full block to the right.
This value can be altered to change where Mario enters the level with extreme precision; for example, adding 10 to this value in a pipe-based warp can cause Mario to appear to warp through a 1-block-wide pipe. Additionally, this allows entrances to be placed at the borders of the levels, where the editor does not allow warps to be directly placed.
===== Value 3 (Y Position) =====
The value determines how far from the uppermost space in the level the entrance is, with 20 representing one full block downwards.
The practical applications of altering this value are the same as those of value 2, but on the vertical axis instead. 
===== Value 4 (Entrance Direction) =====
#	Direction Faced Upon Entrance
1	Right
2	Left
Note: This table is incomplete for in the interest of simplicity.
By changing this value to 2 in a no-animation entrance or a vertical pipe, The level maker may set Mario to face left instead of right, which makes levels or sections of levels where the player must go left better-looking and/or more intuitive. If this value is changed in a horizontal pipe, Mario will appear to walk backwards out of the pipe.
==== Exits ====
===== Value 1 (X Position) =====
This value determines how far from the leftmost space in the level the exit is. Unlike with entrances, 1 full block to the right is represented by 1 instead of 20.
While the level-loading system accepts exits with this value in decimal form and the exit's position is portrayed accurately in the level editor, the exit may not be accessed in-game. Exits may, however, be placed on the borders of a level in the same manner as an entrance and still function normally.
===== Value 2 (Y Position) =====
This value determines how far from the uppermost space in the level the exit is, with 1 full block downwards being represented by 1. The practical applications are the same as with value 1.
===== Value 3 (Exit Type) =====
#	Description
1	Door
2	P-Switch Door
3	Downward Pipe
4	Upward Pipe
5	Rightward Pipe
6	Leftward Pipe
Like with value 1 for entrances, there are no exit types that cannot be placed directly through the level editor, so altering this value has no practical application.
===== Value 4 (Connected Entrance) =====
The value of this number leads to the entrance whose number is 1 greater than this value.
Value 4 + 1 = Entrance Number
Altering this value only serves as a shortcut and cannot do anything that cannot be done directly via the level editor.
Category:SMF1 Features
Category:SMF2 Features
Category:Code Editing