Screen by Screen Scrolling Engine with a Map Editor

ver.0.4.2 WIP

by Lachie D. (10.02.2008)
   http://lachie.phatcode.net
   http://games.freebasic.net
   http://games.freebasic.net/forum


About
=====

This is a screen by screen scrolling engine 
with a map editor. The current version allows you 
to edit the available locations (3 of them), add 
MANUALLY new ones in the script files (you'll have 
to prepare maps for them), and walk around the 
created locations. On one location there are 4
NPCs to interact with.

The engine and the map editor are meant to allow 
easy creation and editing of screen by screen
scrolling games, featuring various resolutions and 
tile sizes.

This package consists of two script files. One
for resolution 320*240 and one for 640*480.

The engine features background, foreground and 
collision layers.

Foreground layer consists of player's sprites, NPC's
sprites, and foreground tiles (objects). Using a
placeholder array and a sorting function (qsort), they
are sorted so that those with lower Y position are
drawn first. This creates the illusion of 3rd 
dimention (depth).

Portals are drawn in the engine for testing purposes. 
They won't and shouldn't be visible in games based 
on this engine.

The graphics are only placeholders and the example
maps are there only to test the engine and the map
editor. This is not a start of a new game!

The NPC code is also temporary, and is there to
illustrate my foreground objects sorting.

About the script files
======================

Script files set the screen resolution, tile size,
number of locations, and their definitions.

Location x and y size set the number of SCENES
vertically and horizontally.

West, east, north and south exits were meant
to feature automatic exiting (not connected with
portals) when you reach the edge of a certain 
location (the number defines the target location), 
but due some problems in the very concept I didn't 
implement any in the script files (although the 
code for them is implemented).

'colliding tiles start' represent the starting value
at which the tiles in the base layer will be 
considered colliding.


About the map editor
====================

Press 'H' while using the map editor for controls.
It's a rather simple map editor to use, but lacks
quite few options right now and better interface.
Especially related to starting new locations
from scratch.

Placing portals is somewhat tricky right now, but
I'm not sure how that can be improved. In the
current version you can place 50 portals on one
scene. Several portals are already implemented
in the example maps. Numbers by portals represent
the scene they lead to.

To swap between the layers use SPACE.

There are 4 layers implemented.

There is the base one which is drawn always before the
player. It may or may not feature colliding tiles. You 
set that in the script file.
The foreground layer draws foreground tiles/sprites
that are in the level (same height) with the player, 
meaning, the player can visually appear above or 
below them (cover them or not, depending on position).
The collision layer features objects with which the
player will collide in pixel perfect manner.
The overlay layer is like a super-foreground layer.
It consists of tiles/sprites that are always drawn 
over the player, not matter if the player is above or
below them (like tree branches, and similar).

Foreground and overlay logic applies on NPCs too.

Only by drawing appropriate sprites and placing them
in appropriate layers you'll get the desired effect.

Use F8 to turn on/off the background layer (useful
when cleaning other layers from unneeded tiles).

Use F9 to turn on/off all the layers, to see the
end result.

Use right mouse button to swap between placing
methods (place tile, place portal, delete portal).

Portals are placed in its separate layer so 
when placing them it doesn't matter in which
layer you are (base/foreground).

When you change a tileset for a specific scene
you need to save the entire script for this
data to be saved (F3).


Planned features
================

Complete and improve the map editor. Add more 
flexibility. Add a layer with objects from which
the player will slide off (squre-shaped or 
circular blocks). Add NPC implementation/managing
infrastructure. Change portal activation method
(it should check the player's direction too).





