Code: Select all
----- This is a comment
----- Begin User-made Triggers
for (i > 0, i < 21, i++)
{
wait 0.5s;
bridgeLayer(block) - i;
}
This is for use in Castle levels where when you get the axe the bridge disappears block by block. Usually to achieve this behavior in smbx you'll have to add like 20 layers for each separate block and 20 chained events. This will wait 0.5 seconds, remove a block from the left side of the bridgeLayer and do the same again - for() loop. This will loop until all the blocks in that layer disappear. For general layer object look below. Another example - taking logic out of the game:
Code: Select all
----- Begin conditional logic
if (enemiesLayer(npc).Dead)
{
Shout("Well Done! You must've killed all the enemies in that layer!");
}
if (enemiesLayer(Goomba).Dead)
{
Shout("You killed that single Goomba within the layer!");
}
Now you saw me use the layer called bridgeLayer() above with the block parameter. This returns all the blocks within the layer. As seen here I don't need the blocks anymore so I switched to npc, you guessed it! This returns all NPCs from the layer. You can do the same for backgrounds, water/quicksand and even warps to manipulate which part of the layer exactly does what. However if you want to hide/show ALL objects in the layer you'll have to pass it the general object parameter unit. Example: layerName(unit).Hide(); This will hide everything within that layer. On the other hand, if you want to target a single npc from within that layer you'll have to do it like this: layerName(npcName).Copy(); This should create a copy of the enemy you want from within the layer. Very useful in combination with loops, so that you can create npcs in-game without actually using the editor to place them.
The shout function is very similar to the textbox within the events window. it's purpose is to display text in the game world, with the game font, and act like a pause until the player indicates they read it. It basically takes a string as it's parameter, nothing too hard just get the text in between the double quotes ("). Escaping quotes like this:
Code: Select all
function LevelStart()
{
Shout("The level called \"MyLevelName\" has been started.");
}
The code above will output the following: The level called "MyLevelName" has been started. This is a bad example because for the level name you could just use the levelName variable, but you get the idea. The function LevelStart() is a game default defined function and cannot be deleted, defined anew nor renamed. However the user can use it to manipulate layers upon game start. There are game-defined layers that act like this, for example Default.
Code: Select all
----- Begin User-made triggers
function onEnemyKIll(layerName(npc), greeting)
{
Shout(greeting);
}
----- Usage:
if (enemiesLayer(Goomba).Dead)
{
onEnemyKill(this, "You killed that single Goomba within the layer!");
}
In the above example I passed this to the function param list. The if logical statement is formed of if (condition) { expression; }. So I passed this as a layerName because it is the layer used in the condition. Remember, if there are more than 1 layer used in condition/loop this should throw an exception because the game doesn't know to which layer you are referring.
With this language you can write 4 or 5 lines of code instead of adding like 20 layers and the 20 events one by one. In most cases programming it would be the easier/faster option.
Sorry if the language seems too hard for you, I'm a junior C# developer and I decided to "borrow" some of Microsoft's syntax ideas
. Basically this language should be from the C family. Also as you saw above nothing too complicated. Since this is a fictional language (yet
) I will be willing to write the syntax and documentation for each function to enable the actual developers to implement it in C++ if people like this idea of course. Also a programming language for a game editor should have its own name, I'm open for suggestions 
EDIT:
Pre-defined stuff as of now:
Code: Select all
Layers:
Default
DestroyedBlock
SpawnedNPC
Events:
LevelStart
onPSwitchEnd
onPSwitchStart
Variables:
unit = accepted by layers. Contains everything within a layer.
block = accepted by layers. Contains all blocks within a layer.
npc = accepted by layers. Contains all npcs within a layer.
background = accepted by layers. Contains all backgrounds within a layer.
warp = accepted by layers. Contains all warps within a layer.
water = accepted by layers. Contains all water gravity within a layer.
quicksand = accepted by layers. Contains all quicksand gravity within a layer.
string = accepted by layers. Contains a user-specified unit within a layer.
levelName = returns the name of the level as set in Level Settings, if none, returns null by default
