User Tools

Site Tools


en:tutorials:orxscroll:maps-in-scrolled

This is an old revision of the document!


Creating Maps in ScrollEd

ScrollEd is a map/level editor that can be used with Scroll.

Compiling ScrollEd with Scroll

ScrollEd is included in the Scroll header files, so you don't have to make any changes to your Scroll project to use it. However, you do have to make sure it is being compiled.

If you have the following defined in a source or header file, comment or remove it. Otherwise, ScrollEd will not be compiled when Scroll is compiled.

#define __NO_SCROLLED__

Running ScrollEd

Running your game's executable will start the game by default. If you want to start ScrollEd, you need to run the executable with the -editor command line switch.

You must also specify a map file to edit using the –map switch.

If you don't want to specify a map file on the command line every time, you can specify a default map file in Orx config as follows:

[Param]
map = ../data/map/Level1.map; <= Setting a default map if none is specified on the command line

Orx objects to be used in ScrollEd need a new property not supported in Orx Used to define “object sets” used in ScrollEd

[O-Boy]
Graphic = G-Boy
ScrollEdSet = Players

[O-EnemyBug]
Graphic = G-EnemyBug
ScrollEdSet = Enemies

After you've defined the ScrollEdSet for each of your Orx objects in config, run ScrollEd again. You will be able to use the mouse wheel to scroll through the object sets. The previous config would create two sets, Players and Enemies, and allow you to switch between them.

The following keyboard and mouse commands are available in ScrollEd. You can find them in data/ScrollEd.ini

[Input]
SetList = ScrollEdInput # ScrollInput

[ScrollEdInput]
MOUSE_LEFT        = Action
MOUSE_RIGHT       = Pan # Zoom
MOUSE_MIDDLE      = Copy # HideSet

MOUSE_WHEEL_UP    = NextSet # NextLayer
MOUSE_WHEEL_DOWN  = PreviousSet # PreviousLayer

KEY_SPACE         = ClearSelection # HideSet

KEY_LALT          = SoftClearSelection
KEY_RALT          = SoftClearSelection

KEY_F12           = Screenshot

KEY_LCTRL         = Zoom # PreviousLayer # NextLayer

KEY_DELETE        = Delete
KEY_BACKSPACE     = Delete

KEY_F6            = Save
KEY_F9            = Reload

KEY_Z             = ToggleMove
KEY_X             = ToggleScale
KEY_C             = ToggleRotate
KEY_S             = ToggleSnap

KEY_G             = ToggleGrid

KEY_D             = ToggleDifferential

KEY_A             = Antialiasing
KEY_T             = Tiling

KEY_R             = EditAlpha
KEY_Q             = EditRed
KEY_W             = EditGreen
KEY_E             = EditBlue

KEY_TAB           = ResetZoom

KEY_F3            = ToggleFullScreen
KEY_HOME          = ReloadHistory

KEY_ESCAPE        = Quit

KEY_F5            = StartGame

CombineList       = @ScrollEdInput.KEY_LCTR

Call SetMapName from the Scroll class to load the map in Scroll

Then do the following:

// Asks for map restart
  mbRestartMap = orxTRUE;

mbRestartMap is checked in the Update function and does the following if true:

/ Should restart map?

if(mbRestartMap)
{
  // Pauses game
  PauseGame(orxTRUE);
  // Decreases delay
  mfRestartDelay -= _rstInfo.fDT;
  // Now?
  if(mfRestartDelay <= orxFLOAT_0)
  {
    // Stops game
    StopGame();
    // Loads map
    LoadMap();
    // Unpauses game
    PauseGame(orxFALSE);
    // Starts game
    StartGame();
    // Clears restart status
    mbRestartMap = orxFALSE;
  }
}
en/tutorials/orxscroll/maps-in-scrolled.1345402869.txt.gz · Last modified: 2017/05/30 00:50 (5 years ago) (external edit)