Placement Editor

Description

The Placement Editor is a tool that allows you to visually design levels and screens for your games, which can then be exported and loaded directly into AGK.

Where is the Placement Editor?

This utility is located within the IDE\Utilities folder for AGK e.g. C:\Program Files\The Game Creators\AGK\IDE\Utilities within the folder named Placement Editor.

Within the Placement Editor folder are two folders named Editor (the actual editor) and Viewer (an AGK project to load data exported from the editor).

The Placement Editor folder contains an executable named Placement Editor.exe. Launch this to start the editor.

Adding your own media into the editor

Before you begin creating levels you must copy any media into the media folder of the Placement Editor. By default this is located at C:\Program Files\The Game Creators\AGK\IDE\Utilities\Placement Editor\Editor\media.

If no media is present within the media folder you will be presented with this message when running the editor:

Understanding the interface

Once your media has been copied into the media folder and you launch the editor you will be presented with this:

The following screen shots show the different components of the Placement Editor

Adding media into the scene

You can drag media onto the main editing area, edit its properties and move it around.

New

This button allows you to create a new project. When pressing it a dialog will be displayed on screen that allows you to specify the width and height of your screens and the number:

Load

This button will load any saved data. The file must be named export.txt and be placed in the same directory as the Placement Editor executable e.g. C:\Program Files\The Game Creators\AGK\IDE\Utilities\Placement Editor\Editor.

Save

This will save your data into a text file named export.txt. The data will be saved alongside the Placement Editor executable in C:\Program Files\The Game Creators\AGK\IDE\Utilities\Placement Editor\Editor.

Paint

When the paint option is selected you can paste the last imported item. For example, import an image of a crate and drop this on the screen, now press the paint button, now click on the main editing area to drop another crate.

Delete

Select a sprite and then press the delete button to remove it from the sceene.

Properties

Select a sprite then press the properties icon to display a dialog allowing you to supply a name for the sprite along with rotation and scale values.

Show Borders

When you have multiple screens it may be useful to display the edge of each screen. When borders are displayed blue lines will surround the edge of each screen.

Show Grid

Press this button to show or hide the grid.

Grid Width

This button controls the width of the grid.

Grid Height

This button controls the height of the grid.

Snap To Grid

Press this button to ensure sprites snap to the grid when moving them around.

Sprite Tools

When a sprite is selected several tool icons will appear next to it.

The padlock icon at the top allows you to lock a sprite. When a sprite is locked it cannot be moved. This is followed by two icons that allow you to move a sprite up or down a layer. Click and hold the next icon to rotate the sprite. Click and hold the icon below to scale a sprite. The final two icons allow you to mirror and flip the sprite.

Viewing data in AGK

A Tier 1 AGK project is available within C:\Program Files\The Game Creators\AGK\IDE\Utilities\Placement Editor\Viewer.

Ensure you copy your saved data (export.txt) and any media into the media folder. Now open the project and you will be presented with this code:

// placement editor loading code
#include "placement_editor.agc"

// globals for the placement editor global dim g_Entities [ 1000 ] as tEntity global dim g_MediaList [ 1000 ] as tEntity global g_iEntityCount = 0 global g_iMediaCount = 1 global g_fJoystickSpeed#
// load a level using a virtual resolution LoadFromPlacementEditor ( "export.txt", "virtual" )
// load a level using the percentage system // LoadFromPlacementEditor ( "export.txt", "percentage" )
// to delete data call // DeletePlacementEditorData ( )
// our main loop do // scroll the screen joystickX# = GetVirtualJoystickX ( 1 ) * g_fJoystickSpeed# joystickY# = GetVirtualJoystickY ( 1 ) * g_fJoystickSpeed#
SetViewOffset ( GetViewOffsetX ( ) + joystickX#, GetViewOffsetY ( ) + joystickY# )
// update the screen sync ( ) loop

Run the program and your level will be displayed on screen ready to be used within your AGK game.