Download the PHP package pew-pew/map without Composer
On this page you can find all versions of the php package pew-pew/map. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package map
Map
This component provides basic DTOs for storing, analyzing and transmitting game maps data, as well as loaders for loading this data from arbitrary formats.
Installation
PewPew Map is available as Composer repository and can be installed using the following command in a root of your project:
More detailed installation instructions are here.
Usage
Below is a list of available component value objects, their parameters and methods.
Size
The size object is responsible for the physical two-dimensional dimensions of arbitrary objects.
Size Area
Get the total area of an object provided by size.
Position By ID
In particular, any 3x3 object can be represented in the following form, where each number denotes the corresponding identifier:
Any coordinates can be represented as a scalar ID. To obtain a position by this ID, you can use the following methods.
Position
A position is a primitive object that provides coordinates within an object.
The object does not provide any additional methods.
Layers
A layer is one of the map elements that can define a set of objects to draw, a set of collisions, a set of triggers, or anything else.
Each layer contains a position within the map and its own size.
Tiles Layer
For a layer containing tiles, you should create a corresponding
PewPew\Map\Data\TilesLayer
object. In addition to size
and position
,
it also contains an array of tile IDs.
The size of the tiles array directly depends on the size of the layer and can
be obtained using the Size::getArea()
method.
[!NOTE] For the 3x3 layer, the number of used tile elements corresponds to 9. If there are extra tiles, they are not used.
[!NOTE] If any tile ID is missing, then it corresponds to 0, that means no tile.
TileSet
A tile set is an object containing information about an image containing a set of other images (tiles).
The tileIdStartsAt
constructor parameter is responsible for the starting
ID of the tile, so a 2x2 tile set with tileIdStartsAt: 42
will contains
42
, 43
, 44
and 45
tile IDs.
[!WARNING] The "tileIdStartsAt" cannot be less than 1.
Tile ID Availability
To check the availability of a tile ID, you can use
the containsId()
method.
Position Of A Tile
Updating Tile Pathname
Examples
Example map
Expected output:
All versions of map with dependencies
ext-dom Version *
ext-json Version *
phplrt/source Version ^3.6
phplrt/source-contracts Version ^3.6