Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TMX support #4

Closed
kamranayub opened this issue Oct 27, 2015 · 1 comment · Fixed by #162
Closed

Add TMX support #4

kamranayub opened this issue Oct 27, 2015 · 1 comment · Fixed by #162

Comments

@kamranayub
Copy link
Member

No description provided.

@Dreaded-Gnu
Copy link
Contributor

Just took a look how it can be achieved to support tmx format, which is some kind of XML document.

Is it possible to load an XML document via excaliburjs and transform it into an object? If not, is this going to be added similar to json loading which returns also an object or shall the xml parsing be done within this extension?

With the possibility of an XML to JavaScript object loading handled by the engine itself, the integration of the TMX format would be rather easy and kind of straight forward task.

eonarheim added a commit to excaliburjs/Excalibur that referenced this issue Jan 30, 2021
Related issues:
* TileMap PR: excaliburjs/excalibur-tiled#162
* TMX support: excaliburjs/excalibur-tiled#4
* Full TSX external TileMap support: excaliburjs/excalibur-tiled#23,
* Object model to easily work with layers: excaliburjs/excalibur-tiled#108

## Changes:
* Remove `TileSprite` in favor of `Sprite`
* Fix some bugs with scaling/rotation of Sprites
   - Add `fromAnchor` to draw around anchor or from the left corner
   - Anchor still defines where rotations/scaling is applied to the sprite
eonarheim added a commit that referenced this issue Aug 27, 2021
## Summary

This PR introduces full support for parsing all of Tiled's supported data formats. Additional there is object model and build in Excalibur Tile Map support for everything except orthographic or hexagonal maps.

This is a breaking change,
* We are going to change how official plugins are packaged `@excaliburjs/plugin-tiled` the old package will remain unchanged
* We are going to re-align our versions to map to Excalibur in prefix
    * Excalibur@v0.25.x = @excaliburjs/plugin-tiled@v0.25.y 

## Features

* Parse default Tiled tmx files
  - Supports all Tiled compressions zlib, gzip, and zstd
* Parse Tiled exported json files
* Supports external tilesets `.tsx` and `json`
* New TypeScript based object model for working with Tiled data
  * Query for layers by property
  * Query for objects by property
  * Easy helpers to locate Polygons, Polylines, and Text
* Automatic Excalibur wiring for certain Tiled properties and objects:
  * Camera
  * Colliders
  * Solid TileMap Layers
  * Tiled Text
  * Inserted Tiled Tiles

### Excalibur Wiring

You may opt-in to the Excalibur wiring by calling `addTiledMapToScene(someScene)`

```typescript
// After loading tiledMapResource
tiledMapResouce.addTiledMapToScene(game.currentScene);
```

* Camera Position & Zoom - You may set the starting camera position and 
  - In an object layer with a custom property "excalibur"=true
  - Create a Tiled "Point" with the Tiled Type "Camera"
  - Optionally, to set zoom other than the default of 1.0, create a custom property named "Zoom" with a numeric value

* Solid layers - You can mark a particular layers tiles as solid in Tiled
  - In the Tiled layer properties, add a custom property named "Solid" with a boolean value `true`
  - The presence of a tile in this layer indicates that space is solid, the abscence of a tile means it is not solid

* Colliders - You may position Excalibur colliders within Tiled
  - In an object layer with a custom property "excalibur"=true
  - Create a "Circle" (ellipses are not supported) or "Rectangle"
     - Set the Tiled type to "BoxCollider" or "CircleCollider" 
     - Optionally, to set an Excalibur collision type specify a custom property named "CollisionType" with the value
        - "Fixed" (default for colliders) - non-movable object
        - "Passive" - triggers events, does not participate in collision
        - "Active" - participates in collision and can be pushed around
        - "PreventCollision" - all collisions are ignored

* Text - You may insert excalibur labels within Tiled
   - In an object layer with a custom property "excalibur"=true
   - Create a Tiled Text object

* Inserted Tiles - You may insert tiles off grid in Tiled
   - In an object layer with a custom property "excalibur"=true
   - Create a Tiled inserted Tile
   - Optionally, to set an Excalibur collision type specify a custom property named "CollisionType" with the value
        - "Fixed" non-movable object
        - "Passive" (default for inserted tiles) - triggers events, does not participate in collision
        - "Active" - participates in collision and can be pushed around
        - "PreventCollision" - all collisions are ignored

TODO before merge:
* [x] Update to alpha Excalibur build for CI
* [x] GH Actions
* [x] Integration Test
* [x] Delete notes
* [x] Update examples
* [x] Compatibility with new Excalibur Graphics API

Closes:
* TMX support: Closes #4
* Full TSX external TileMap support: Closes #23,
* Object model to easily work with layers: Closes #108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants