Moktar

***Moktar*** is a user-generated sidescrolling platforming game in the *Svea* series.

## Signals

All entities in the game read **signals** of some form. Signals are alphanumbered with **unique IDs**.

Signals come in three variants: **global**, **class**, and **entity**. The first may be read by any entity, the first only by entities of the same type (e.g. all Beeps), the last by only the *specific* entity that it pertains to.

Signals are all integers. A value of 0 is considered OFF, while a value of 1 or above is considered ON. Signals may be manipulated by toggling them, setting them as ON/OFF, incrementing by a number, or decrease. Signals remember their previous value, so turning back ON a signal will set it to its previous integer value, not just 1.

**Entity behaviour**/**properties** are manipulated by signals, and their **events**/**triggers** are able to manipulate signals in turn.

ONMovesIfA&BUpon: Death▲A1
## Tracks

**Tracks** are heavily featured in *Moktar*. Any entity attached to a track will move along its path until reaching an endpoint, which will determine if the entity reverses or falls off, or the track might loop.

Multiple tracks may exist on the same grid space, if differentiated properly where they overlap by assigning **unique IDs** to those lenghts, not unlike signals.

Tracks come in pieces that attach to one another, per *half* grid length. Naturally, many properties are found for each piece to be customized.

**Track pieces** come in multiple directions as well, including various turns.

* Track piece:
	+ Horizontal.
	+ Vertical.
	+ Diagonal.
		- Lower Left, Upper Right.
		- Upper Left, Lower Right.
	+ 22.5° – Always 2 length units. Can only attach to nodes 2 lengths away.
		- Lower Left, Upper Right.
		- Upper Left, Lower Right.

**Nodes** can be placed at any point between two tracks.

* Nodes:
	+ No node – Default. Entities will fall off if no track available.
	+ Launch node – Entities will fall off if no track available, but be launched while doing so.
	+ Reverse node – Reverses travel direction of entities.
	+ Direction node – Entities will change travel direction.
	+ Direction node – Entities will change travel direction to a random available one.

Some nodes can completely replace predictable track patterns, known as **travel nodes**:

* Redirection node – The speed of entities is completely transferred in a direction, and will begin travel with that speed.
* Redirection no gravity node – The speed of entities is completely transferred in a direction, and the physics of the entity is completely ignored, as if they were traveling on tracks. Will attach to the next appropriate track/node they come in contact with.
* More advanced forms exist of no gravity nodes, in which the player "expands" the node to create advanced patterns to be followed once an entity comes into contact with the node.
* Some presets allow for curved, circular, and oval patterns as well.
* The node can determine wether the entity travels by its **collision point**, or realign itself to its **center point**.

## Interaction

Any entity can have **interaction** with other categories of entities. The most common interaction is with ground blocks, allowing the entity to collide with them instead of falling through.

This behavior is primarily done with checkboxes for each category, but can be made more advanced as well. Signals can determine whether or not a checkbox is toggled on/off, for example.

Some interactions are specific between types of entities, for example the fire entity will interact specifically with the bomb entity, causing it to explode.

## Magnetization

Any entity can have a single type of **magnetization**, or none at all.

The generic type allows the travel along any track; the entity will only switch tracks if they have completely left the one they traveled on first, then came in contact with another.

Other magnetizations use **unique IDs**, the same as tracks. These entities may only travel along matching tracks.

## Glue

Entities can be **glued** together. The entity that touches the surface will determine the movement of the entire glued-together entity.

Glue has a few different states that can be manipulated with signals:

* Disabled – Glue is inactive. If a piece is moved away, glue is destroyed.
* Soft – Parts can be destroyed, along with glue.
* Hard – Parts cannot be destroyed individually. Any entity with hard glue is considered 1 entity. Either the whole thing is destroyed, or none of it.

## In-Level Currency

The player collects golden coins as they explore. Certain blocks may only be destroyed by paying an amount of coins, directed in the level only. This can create contraptions with alternate routes or a shop system, as well as rewards players taking risks for extra coins.

The player also has a dedicated **purchase** button. Consuming an amount of coins, they are immediately rewarded 1 health point. When all health points are restored, they will instead be granted an upgrade. These can be customized by the level creator.

## Player

The **player character** has the ability to tap on an entity and drag, launching them in a direction. This also magnetizes them, allowing them to travel along any tracks they hit.

Simply tapping onto an entity will either magnetize them, or remove that status.

The Y button allows the player to toggle their own magnetized status, allowing for simple jumping onto a track, then go along it.

## Pending

### Overlap Entity

* An **overlap** entity can be placed, to which multiple other entities may be created within its sub-space.
* These entities will all be created and active on the same coordinates when playing, but hidden in the edit mode.
* This is to ease creation.

### Personal Paths / "Internal Tracks" / Wings

* Tracks can be used to create **movement behaviour** for flying entities as well.
* These entities will be unaffected by gravity, but other physics may apply.
* Opening the entity's movement pattern allows the player to place track pieces and nodes in a sub-space.
* Closing the entity's movement pattern hides the tracks, these are internal only.
* Playing, the entity will move in the internal track pattern only.