Room

From ENIGMA
Revision as of 20:26, 12 September 2017 by RobertBColton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The LateralGM Room Editor

A room is a rectangular region through which game play will take place. You may place instances of objects in it, and they will interact (as programmed) when the game is run. You may set up background images, add tiles, and change various room settings, like the size, caption, and speed of game play. Finally, especially useful for large rooms, you can constrain how much of the room is seen during game play by using Views.

A game can be broken up into multiple rooms, which is useful for different levels or different areas of the game. Any game will need at least one room. The first room listed in the resource tree in the game project is the first room loaded when the game starts.

Variable-related attributes

A room has width and height dimensions measured in pixels. The default room size is 640w x 480h. The variable room_width returns how many pixels wide the room is, and room_height returns how many pixels tall. The left, top corner of the room is x = 0, y = 0.

Another important predefined variable is room_speed. This gives the number of steps per second that the game will attempt to render. (Actual, or achieved, steps per second is measured by the predefined read-only variable fps).

Room components

Rooms can be drawn with a solid background color, or with up to 8 Background resources. Backgrounds may be layered, and may be set to tile horizontally, tile vertically, stretch to fill the room, and move vertically or horizontally at a defined speed. Backgrounds may also be used as foregrounds, in which case they are drawn in a layer above objects so that objects appear to go behind them.

Background images can also be set up to work as a Tile Set, where sections of the background are added to the room as needed to create a mosaic image, or as static (non-interactive) images in the room. Tiles are often augmented with simple instances of (often invisible) objects to provide collision detection for terrain, platforms, and so on.

The boundary of a room is permeable - instances may move from inside the room boundary to outside, and back again. Instances may exist entirely outside of the border of the room, and continue to function as normal. Areas outside the boundary of the room are never seen in the game window, however (except in 3d mode). Normally if an instance leaves the confines of the room, it should be destroyed or disabled. Events and Actions may be programmed for an Object to make it perform various actions at the boundary of the room, like destroy the instance or wrap it to the opposite edge of the room.

The most basic room is sized to the same size as the window that the game runs in. Larger rooms, which scroll, necessitate the use of Views. Up to 8 views may be defined for a single room, view[0] through view[7]. A view needs to follow a specific object in order to function properly when the view is set up to show a sub-section of the room. Views can also be used to create split screens and zoom effects.

Tile layers

Tile layers.png

Tiles are used to create the game's background. They are not linked to events or actions and are much more lightweight than instances. Tiles are structured in different layers. Layers with highest values will be displayed in latest and will be always visible. You are always working on a specific layer when you add or modify a tile. The active layer is displayed in the drop down menu 'Current Tile Layer'. It contains all layers in the current room. You can add a new layer with the 'Add' button, or delete a layer with its tiles with the 'Delete' button. The check-box 'Hide other layers' will hide all layers except the active one. The check-box 'Edit other layers' allows the user to work on all layers at the same time.

Option buttons

Modes.png

These buttons are used to manage the following options : the first one changes the 'Snap to grid' option. If this option is activated, all objects are placed according to the grid. When the second option 'Add on top' is activated, it will ensure that new objects are always added when you click the left button in the room, regardless if there is already an object under the mouse cursor. If the third option 'Add multiple' is activated, it will add continuously objects under the mouse cursor when the left mouse button is pressed. These options can be enable or disabled temporarily by pressing the following keys : Alt (disable 'Snap to grid'), Ctrl (enable 'Add on top') and Shift (enable 'Add multiple').

Selection tools

Selection tools.png

There are two selection modes in LateralGM : the single selection object mode, which is active by default, is used to select a single object. This mode can be selected by pressing the arrow button. The second mode, the region selection mode, is activated by pressing the rectangular selection button. In order to select a region, the user draws a rectangle in the room:

Draw selection.png

When a region has been selected, it can be filled with an instance or a tile. If the region has to be filled with an instance, the instance type has to be selected first in the objects tab:

Select instance.png

Then the selection region can be filled by pressing the bucket button. If the 'Delete underlying' option has been selected, all instances which are already exist in the selection will be deleted before filling the region. If the 'Snap to grid' option is selected, the region will be filled according to the grid :

Fill region 1.png

If the 'Snap to grid' mode is deactivated, the region is filled according to the instances or tiles size :

Fill region 2.png

The principle is similar for tiles : the user has first to select a layer and a tile in the tiles tab, and then he can fill the selected region with the fill button.

In order to delete instances or tiles in the selected region, the user can press the 'Delete' key or press the 'Delete instances/tiles' button (The button with a red cross). If the objects tab is selected, instances will be deleted, and if the tiles tab is selected, only tiles will be deleted.

Preferences

It is possible to customize the appearance of the selected region by modifying the options in preferences window. The options are stored in the 'Room editor' section in the 'Rectangular selection' panel. By default the selected region is a semi-transparent rectangle filled with a blue color :


Rooms editor preferences.png

Cutting, copying and pasting regions

Cut copy paste.png

The buttons 'Cut' (Ctrl-x), 'Copy' (Ctrl-c) and 'Paste' (Ctrl-v) are used to copy and move regions. If the user wants to copy a region, first he will select the objects tab for selecting instances and the tiles tab for selecting tiles. Then he will select the region with the 'Select a region' button and draw a rectangle :

Select region.png

Then the 'Copy' and 'Paste' buttons are clicked. If the the tiles tab is selected, only tiles of the current layer will be selected, except if the option 'Edit other layer' is checked. When the paste is done, a stamp is created with a semi-transparent image of the selection :

Stamp.png

The user can move the stamp and click on the left mouse button, and it will copy the selected region on the given position :

Pasting region.png

If the 'Delete underlying' option is selected, it will delete first the instances or tiles in the region before filling it. If the user wants to exit the pasting mode, he can select 'Select an object' if he wants to select an single object or 'Select a region' to select again a region. If the user press the 'cut' button instead of the 'copy' button, the objects in the region will be deleted before copying the region.