makotok / Hanappe

Hanappe is a game framework for MOAI SDK.
Other
107 stars 41 forks source link

setGid doesn't work with "unused" tiles #69

Closed Quedex closed 11 years ago

Quedex commented 11 years ago

A tile now needs to have previously been placed on the map or else TileLayer:setGid returns an error. Note: This does not happen on the first tilset loaded into Tiled but on every additional tilesets! So if you use TileLayer:setGid with an unused tile from a tilset other than the first, an error is produced.

In addition to this, it should also be possible to set gid = 0, to remove a tile from the layer.

makotok commented 11 years ago

Thank you for reporting. I could not understand well.

Is there a code and sample data? Or, Is there a stack trace?

makotok commented 11 years ago

I was able to understand somehow. The following code does not work?

tileLayer:setGid(0)

Would bug. I will fix.

Quedex commented 11 years ago

That's correct.

But in addition to that there's another problem as well. I'll try to explain. Let's say you use several tilesets on your map and try to place a tile on the map with tileLayer:setGid(100) (100 just being an example) Then if the tile with gid=100 is NOT from the first tileset AND if the tile with gid=100 has NOT been placed on the map, an error is produced.

makotok commented 11 years ago

Fixed. I want you to check whether there is any problem.

Quedex commented 11 years ago

I still get an error if gid=0. In your map_editor example I changed the code to self.editGid = 0 and an error shows up.

makotok commented 11 years ago

I'm sorry, bug had left. I was fixed again.

Quedex commented 11 years ago

I have also managed to reproduce the other, rather strange bug, and unfortunately it isn't fixed yet. I'm not sure if my first assumption on how the bug occurs is right either. If, in your map_editor example, you yet again set self.editGid to the firstGid of all your actors the following occurs: If gid is set to one of the following: 513, 525, 537, 561, 573, 621, 889, 901 (actors: 50, 1, 52, 54, 55, 51, 2 and 3) everything works just fine. However, if gid is set to one of these: 549, 585, 597, 609 (actors: 53, 56, 57 and 58) the error is produced!

makotok commented 11 years ago

Sorry. I had to leave the bug yet. I think Fixed properly this time. . .

Quedex commented 11 years ago

That's it. Everything seems to be working fine now. Thanks.