Level Design

Level Design Blocks

What are Level Design Blocks?

Level design blocks are code blocks that interact with the stage and level editor. They help you do things like change your stage viewport or place a tile during the game.


{"func":"blockLooksViewportCamera"}

Set Viewport Camera

"Set Viewport Camera" sets the screen viewport on a specific actor.

Parameters:

Actor: set this to the name of the actor that to set the camera to.

Related Blocks:
{"func":"blockLooksSetLevel"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksViewportCamera","values":[{"type":"string","value":"self"}]}} Add to my Backpack


{"func":"blockLooksSetLevel"}

Set Level To

"Set Level To" will allow the game to jump to a specific level.

Parameters:

Level: this parameter determines which level the game will jump to.

Related Blocks:
{"func":"blockLooksViewportCamera"} ,     {"func":"valueLooksGetLevel"} ,     {"func":"valueLooksGetLevelNum"} ,     {"func":"valueLooksNumLevels"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActorActive","values":[{"type":"string","value":"self"},{"type":"boolean","value":"true"}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"Door-Closed"}],"next":{"func":"blockControlWaitUntil","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"string","value":"100"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"knight"}]}]}],"next":{"func":"blockLooksSwitchCostume","values":[{"type":"string","value":"Door-Open"}],"next":{"func":"blockLooksSetLevel","values":[{"type":"string","value":"2"}]}}}}}} Add to my Backpack


{"func":"valueLooksGetLevel"}

Get Current Level

"Get Current Level" returns the name of the level that is currently being played.

Parameters:

None.

Related Blocks:
{"func":"blockLooksViewportCamera"} ,     {"func":"valueLooksGetLevelNum"} ,     {"func":"valueLooksNumLevels"}

Sample Code:
{"func":"blockLooksSayFor","values":[{"type":"string","value":"Welcome to"},{"type":"wrapper","func":"valueLooksGetLevel"},{"type":"string","value":". "},{"type":"number","value":"2"}]} Add to my Backpack


{"func":"valueLooksGetLevelNum"}

Get Current Level Number

"Get Current Level Number" returns the number of the level that is currently being played. The current level number returned is a number between 0 and the maximum level less 1.

Parameters:

None.

Related Blocks:
{"func":"blockLooksViewportCamera"} ,     {"func":"valueLooksGetLevel"} ,     {"func":"valueLooksNumLevels"}

Sample Code:
{"func":"blockLooksSetLevel","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueLooksGetLevelNum"},{"type":"choice","value":"+"},{"type":"string","value":"1"}]}]} Add to my Backpack


{"func":"valueLooksNumLevels"}

Get Number Of Levels

"Get Number Of Levels" returns the total number of levels in a game.

Parameters:

None.

Related Blocks:
{"func":"blockLooksViewportCamera"} ,     {"func":"valueLooksGetLevel"} ,     {"func":"valueLooksGetLevelNum"}

Sample Code:
{"func":"blockLooksSayFor","values":[{"type":"string","value":"You are in level"},{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueLooksGetLevelNum"},{"type":"choice","value":"+"},{"type":"string","value":"1"}]},{"type":"string","value":" of "},{"type":"wrapper","func":"valueLooksNumLevels"},{"type":"number","value":"2"}]} Add to my Backpack


{"func":"valueLooksGetTileAt"}

Get Tile At

"Get Tile At" returns the name of the tile at a specific row and column in the tile grid. The tile grid is numbered starting with 0 from left to right, and from top to bottom.

Parameters:

Column: set this to the column in the tile grid of the tile that is to be returned.

Row: set this to the row in the tile grid of the tile that is to be returned.

Related Blocks:
{"func":"valueLooksGetTileAtPoint"} ,     {"func":"blockLooksSetTileAt"} ,     {"func":"blockLooksSetTileAtPoint"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueLooksGetTileAt","values":[{"type":"number","value":1},{"type":"number","value":1}]}]}} Add to my Backpack


{"func":"valueLooksGetTileAtPoint"}

Get Tile At Point

"Get Tile At Point" returns the name of the tile at a specified X and Y coordinate.

Parameters:

X: This indicates the X value of the tile to be returned.

Y: This indicates the Y value of the tile to be returned.

Related Blocks:
{"func":"valueLooksGetTileAt"} ,     {"func":"blockLooksSetTileAt"} ,     {"func":"blockLooksSetTileAtPoint"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"false"}],"next":{"func":"blockControlForever","containers":[{"func":"blockMotionGoTowards","values":[{"type":"string","value":"mouse-pointer"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueLooksGetTileAtPoint","values":[{"type":"wrapper","func":"valueSensingMouseX"},{"type":"wrapper","func":"valueSensingMouseY"}]}]}]}}]}}} Add to my Backpack


{"func":"blockLooksSetTileAt"}

Set Tile At

"Set Tile At" sets the type of tile at a specific row and column in the tile grid. The tile grid is numbered (starting with 0) from left to right, and from top to bottom.

Parameters:

Column: set this to the column in the tile grid of the tile that is to be changed.

Row: set this to the row in the tile grid of the tile that is to be changed.

Related Blocks:
{"func":"valueLooksGetTileAt"} ,     {"func":"valueLooksGetTileAtPoint"} ,     {"func":"blockLooksSetTileAtPoint"}

Sample Code:
{"func":"blockLooksSetTileAt","values":[{"type":"number","value":1},{"type":"number","value":1},{"type":"string","value":"scifiwreck"}]} Add to my Backpack


{"func":"blockLooksSetTileAtPoint"}

Set Tile At Point

"Set Tile At Point" sets the type of tile at a specific X and Y coordinate.

Parameters:

X: This indicates the X value of the tile to be changed.

Y: This indicates the Y value of the tile to be changed.

Related Blocks:
{"func":"valueLooksGetTileAt"} ,     {"func":"valueLooksGetTileAtPoint"} ,     {"func":"blockLooksSetTileAt"}

Sample Code:
{"func":"blockLooksSetTileAtPoint","values":[{"type":"number","value":-165},{"type":"number","value":125},{"type":"string","value":"clouds"}]} Add to my Backpack