Coder Social home page Coder Social logo

Comments (10)

luanpotter avatar luanpotter commented on May 23, 2024 1

A mistake, for sure! I imagine the extra tile never caused any issues, being empty.

from tiled.dart.

spydon avatar spydon commented on May 23, 2024 1

0.7.3 is now released!

from tiled.dart.

spydon avatar spydon commented on May 23, 2024

It definitely looks like an error on our side (https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tmx-objectgroup). Do you want to put up a PR that fixes it? :)

from tiled.dart.

lfraker avatar lfraker commented on May 23, 2024

@spydon sure thing, will submit one shortly. I didn't see a contributing guide - any process I need to adhere to for the PR, or for something this simple can I just submit the change if all tests pass?

from tiled.dart.

spydon avatar spydon commented on May 23, 2024

@spydon sure thing, will submit one shortly. I didn't see a contributing guide - any process I need to adhere to for the PR, or for something this simple can I just submit the change if all tests pass?

The latter. :)

from tiled.dart.

lfraker avatar lfraker commented on May 23, 2024

@spydon I submitted a PR and included a new test case for this scenario: #32

While testing, I noticed something interesting. It seems like whenever Tiles are being parsed from a TileSet, an extra tile is always added.

The parsed result is initialized as a new TileSet before returning, (https://github.com/flame-engine/tiled.dart/blob/main/lib/src/tileset/tileset.dart line 141).
In the TileSet initialization code, _generateTiles is called which iterates from 0 to numTiles, inclusive, and thus appends an extra Tile that was not included in the input file (https://github.com/flame-engine/tiled.dart/blob/main/lib/src/tileset/tileset.dart line 219):

for (var i = 0; i <= tileCount; ++i) {
      if (t.localId == i) {
        tiles.add(t);
        if (iterator.moveNext()) {
          t = iterator.current;
        }
      } else {
        tiles.add(Tile(localId: i));
      }
    }

I was curious what the reason was for the extra Tile. Should we simply ignore it?

from tiled.dart.

spydon avatar spydon commented on May 23, 2024

Fixed by #32

from tiled.dart.

lfraker avatar lfraker commented on May 23, 2024

@spydon @luanpotter, forgot to update the package version in the PR. Are you able to bump the version so I can pull the latest package, or is there a release process for publishing?

Hoping to use this fix in a project I'm working on!

from tiled.dart.

spydon avatar spydon commented on May 23, 2024

@spydon @luanpotter, forgot to update the package version in the PR. Are you able to bump the version so I can pull the latest package, or is there a release process for publishing?

Hoping to use this fix in a project I'm working on!

I can do a release later today hopefully (you don't bump the version in the separate PRs, it's a separate process).

from tiled.dart.

lfraker avatar lfraker commented on May 23, 2024

Awesome, thank you!

from tiled.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.