Index · Editor · Blocks · Areas · Entrances · Game/Zone · Scripts/Reference · Tools · Shortcuts

[ ] NuggED: Blocks

Blocks are the main components of any Nugget level (zone).
Everything on the game screen, besides text, is a block. Everything
that moves, is a decoration, or interacts with the player, is a block.
(The player character itself is a special block created automatically.)

Jump to Properties / Flags

Blocks are defined by size, position, visual properties, and a variety
of flags (set or unset) and settings related to motion, interaction, etc.
These settings are edited in the Block Properties sidebar while they are
selected. If one block is selected, changes are applied instantaneously.
If multiple blocks are selected, you must press Enter to apply the
property box with cursor focus to the entire selection.


You can insert a new block by pressing Ctrl+B. They can be
copied, cut, pasted, dragged, duplicated, and deleted just like in other
software. There are various shortcuts to speed up block editing,
but most work is done in the Block Properties sidebar:

List of Block Properties

This "object" name uniquely identifies a block within a zone. Most blocks,
such as simple solid platforms, do not need an Oname. Onames are only
required if you want to control or modify a block through scripting.
They are also useful within the editor, for example when you want to
find and jump to a specific named block by pressing Ctrl+F.
Names should only use alphanumeric characters (a-z, A-Z, 0-1).
Note: You cannot name a block "you" because this is reserved
for the player's character block, added by the game engine.

X, Y
This is the default position of the block, in x/y coordinates. If the
motion flag is set, these are ignored and the X, Y Limits are
used instead (see below). If the dynamic flag is set, the block
will start here and immediately fall according to the zone's gravity.

W, H
This is the size of the block, in width and height. Currently, these values
cannot change during gameplay, not even through scripting. Most blocks
never need to change size. In special cases, you can fake it by storing
a hidden block of a different size and unhiding it when necessary.
(Note: You should check out the various shortcuts which
make moving and resizing blocks much quicker and easier!)

Z, Level
You only need to fill in one of these. You can manually enter a block's
z coordinate, or enter its level as a 0-based index. It is always
recommended to enter the actual z coordinate, and let the game match
it to the nearest depth level. (If the scenic flag is set, the block
will remain at the arbitrary z depth you enter, rather than moving to
the nearest level, but then it cannot collide with any dynamic blocks.)

Color (1), Color 2
Usually a block only needs one Color assigned. The second color is
used when the block is marked cyclic (it will fade between the
two colors according to the specified waveform and frequency) or
when the script command flipcolor is used.
You can specify −1 to make a block invisible but still show its eyes,
(if and only if the hasface flag has been set).
For checkpoint blocks, you should leave both colors blank, unless
you want it to repeat a specific color when activated in-game.
You can left-click the color preview to open a color picker,
and right-click to swap Colors 1 and 2.

This allows you to specify an optional transparency level
ranging from 0.0 to 1.0 (fully opaque to invisible).
Warning: This is not "true" transparency; it simply mixes
the block's color (and its black border, if solid) with the zone's
background color. This means that other blocks behind it will
not be visible. If the block is marked hasface, its eyes
will be visible and fully opaque, except at 1.0 transparency.

This is an advanced feature. A block's priority can be
manually set to force a specific block draw order, or to
fix collision problems involving dynamic blocks.
Case 1: If two blocks overlap within the same z-plane, it
may not be obvious which will be drawn "in front" in the game.
You can give one a higher or lower priority to force an order.
Higher priorities are drawn first or "behind".
Lower priorities are drawn last or "in front".

Priority should be an integer, positive or negative, around zero.
Case 2: The game uses a simple custom physics engine.
In some special cases, you may find a dynamic block
fails to collide properly and passes through other solid blocks.
Usually, this can be fixed by giving the dynamic block a
higher priority, which should assist the collision algorithm.

This is an obsolete property which should not be used!
It allows cyclic blocks to persist when the player warps
between two zones (with the same persist tag) without
resetting its current angle or frequency. The block must exist
identically in both zones, with the same properties and Oname.
This feature is rarely needed, and may be removed in a future version!

This lets you assign a block to a certain user-defined "class".
Classes allow you to create dynamic blocks that have simple
artificial intelligence, plus share identical visual properties and flags.
See the game page for more information.
Note: The class flag will automatically be set at zone start.
You can unset the class flag via scripting to disable the AI.

These are 20 diverse properties which are either set or unset,
with their defaults determined by the sidebar checkboxes.
See the flags section below for details.

X, Y Limits
For blocks with the motion flag set, these coordinates determine the
block's position. Each should be a single value (for fixed x, or fixed y),
or two values separated by a comma like x1,x2. If the cyclic flag is also set,
the block will oscillate between points (x1,y1) and (x2,y2), but
the exact path will depend on the Waveform property.

This sets the oscillation pattern (for color and/or motion) of a cyclic block.
Sine: a basic sinusoidal cycle. (Also see circular flag.)
Square: switch instantaneously between the two extremes.
Sawtooth: steadily rise from one end to the other, then switch back abruptly.
Triangle: alternate between the two extremes at a constant rate.
Parabolic: a faked "jumping" pattern. The block will move in a parabola from
point (x1,y1) to (x2,y1), peaking at (xmid,y2), and back again.
Proximity: the block will move to y2 when the player is nearby, and
y1 when the player is far away. See "DC" below.
Random: flicker randomly between the two extremes.

Frequency, Fall Speed, Spatial Frequency
This value can have one of three selected meanings:
Frequency: For all waveforms except Proximity and Random, this is
simply the cycle's frequency, in cycles per second (Hz).
Fall Speed: For Proximity blocks, this is the speed at which the block
rises/falls when the player gets too close/far.
Spatial Frequency: For blocks marked spatial, this determines the
realtime angle as a function of the player's x coordinate as:
θblock = freqspatial × xplayer + θoffset

This "duty cycle" property has various meanings:
For Sine, Sawtooth, Random waveforms: no effect.
For Square, Triangle: this decides how much time is
spent in each half of the cycle (0.0 to 1.0, default 0.5).
For Parabolic: decides how much time is spent in the air
versus "waiting" at the two endpoints (0.0 to 1.0, default 0.5).
For Proximity: this is the minimum distance at which the
player triggers a transition from y1 to y2.

This sets a finite integer limit on the number of times a cyclic
block will repeat its cycle. Unspecified or −1 will repeat the
cycle forever. This can be changed during gameplay via scripts.

This allows you to specify a positive or negative cycle start
angle ("phase") in degrees; here, -360 = 0 = 360 = 720, etc.
This is also used in spatial block calculations as θoffset.

This allows you to specify a gravity factor (for dynamic blocks)
different from the zone's gravity (default 1.0). This property
is also available to modify in realtime via scripts (setgrav).

You can optionally assign two scripts to any block:
StandOn: This is triggered when the player stands on top of a block
(or touches a checkpoint). Bouncing impacts do not trigger it.
Die: This is triggered when a dynamic block is killed.

List of Block Flags
These are the flags which affect a block's appearance and behavior.
Their default states are set in the sidebar checkboxes, but they can also
be changed within scripts by the set/unsetflags commands,
specifying the brief lowercase flag names listed in italics.
If set, dynamic blocks can collide with (or stand upon) this block, rather than passing through it. A thin black outline will also appear if it is on the same z-plane as the player. Not valid with scenic.
If set, this enables block gravity, simple AI via "classes", movement via scripting, and death by deadly blocks or solid crushing. Not valid with motion.
If set, this block can be placed at any arbitrary z-depth (it won't be stuck on any z-level) and cannot collide with dynamic objects. Not valid with solid.
No Border
If set with solid, no black outline will ever be drawn. If set with scenic, a black outline will be drawn whenever the player is within 1.0 units of z-distance.
Has Face
If set, this block will have a "face" (just round white eyes with square black pupils). Pupil direction is controlled by the look command (default = look at player).
Sad Eyes
If set with hasface, the block's eyes will appear sad (this overrides the evil flag).
Evil Eyes
If set with hasface, the block's eyes will appear angry.
If set, this block will kill any dynamic block that it come into contact with it.
If set, this block becomes a circle and serves as a checkpoint when the player touches it.
If set, the block is totally invisible (including its face).
If set, the block's waveform properties are utilized to cycle its colors or, with motion, its physical position.
If set with cyclic, the waveform properties and x/y limits will be used to move the block around. An approximate trail will be displayed in the editor viewport. The T key toggles these trails.
If set with motion and a sine waveform, the block will actually revolve in an ellipse rather than back and forth. To change the direction, swap either the x or the y limits.
If set with cyclic, this block's angle will depend on the player's current x position. See the description of Spatial Frequency above.
If set with cyclic, the block will automatically be solid for 50% of its cycle (or the specified Duty Cycle).
If set with cyclic, the block will cycle between fully transparent and fully opaque.
If set with solid, the block will automatically be Color 2 (rather than Color 1) when the player stands on it.
If set with solid, the player can bounce off the top of this block (once per jump). The bounce velocity will depend on the player's momentum (by default) or a velocity specified as Fall Speed (between 0 and 15).
If set, this block will automatically fill the screen up to the specified y coordinate (x, width, and height are ignored). This is usually used with distant scenic blocks for a simple background effect.
If set along with a valid class name, this block will be controlled by simple user-defined AI. The flag is set automatically at zone-load if a class is assigned, but you can toggle the AI via scripting by setting and unsetting this class flag.


Index · Play Nugget ·