los-cocos / cocos

graphic library for games and multimedia, for python language on PC-like hardware
http://los-cocos.github.io/cocos-site/
Other
634 stars 148 forks source link

The exception in loading .tmx files #359

Open DLDarren opened 1 year ago

DLDarren commented 1 year ago

I met a problem when I was using cocos to load a .tmx file. Cocos doesn't seem to be cutting the tile set correctly when loading the tiles. It looks like these in cocos: image image While the same places in Tiled: image image these are the tiles in the tile set picture: image image I'm using cocos0.6.10 and Tiled 1.9.1 here's the map: `<?xml version="1.0" encoding="UTF-8"?>

eJzt2jEOgzAMBVDoRu9/4O4otEE02MFveBuRjL8wJGJdlmUFAAAAmNwrQQ0AAAAwkr0vQJv5CIz0PhBdVzXfei+XmCx6rouutYLePntG7sniTI/NrjxZ7NdG1/80V3oqD3k82dV3gDz+n0fkeuSRmXmVz9m9hDOt+3P5JbpWAKgk278EW0N0TZXt+y+T2CzkkUdrVsmC2WT7BgAAAOLZJwAAAIxl3wUAAADAEWdHAAAAAP2qn6VUv38AAABgHh9sPSm1 eJzt1UkKwCAQRUHB3P/M2WQlxAk7CqmCfwEfjSkBAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Ft+xj55YMQaaaFLrNkWmsSovfVVTJN4PR1aTVirt4f7+I4/5DxanEkLAAAAAAAAAAAAAAAA4M0N/74Bmw== eJzt1rEVwjAQREGpFIObM7gZMM1hXIy3ACVOhIKZ935y4UVbCgCM65XeaUufjnfavmlPv3R0vNM21VJu6Z7m2u9O25IfPdIzrbXfHeAq+2os9tVY7Kux2FcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD80wn35k9h eJzt28kJACAMBEDb8+i/Hm1BUNQ4A/nvbyEhKQH8LY8pp0MAAAAAcB17I+BXdUw7HYKw9CsAAAAA3MluGAAAAAAAmOG2AAB76VoAAAAAAAAAAAAAAIjj5T+Bl7MDAAAAAACs1AH33QVE eJzt1zsOgCAURUEa1P2v2EYTQ/g1PihmkrsBT0RJCQAAAAAAAAAAAAD2dxRjjbKDLuu8z/xsTI9YMz00idHrUGuiy39a70V+5uyKVeuRi+kRp3dW6RFr9A33rxVLj/3MNnE3jDW6m2sAAAB912espwcAAAAAAAAAAAAAAAAAAAAAAAAAADu7AcP+A7o=

` I have used different maps created with the same version of Tiled, but all of them didn't look well in cocos. However, I succeed when I used a map which was edited in Tiled1.2.5 downloaded on the internet. I guess the problem might be that cocos has some problem with the latest Tiled edition.

ccanepa commented 1 year ago

Can you modify the example in tests\test_tmx.py to use your map? If it shows the same problem, can you upload a zip with all files used, including code, map, tileset's image?

Also, which pyglet version and which GPU are you using?

ccanepa commented 1 year ago

Also, from https://doc.mapeditor.org/en/stable/reference/tmx-changelog/ , Tiled 1.9 did some changes that were partially reverted in Tiled 1.10 for compatibility with Tiled < 1.9

Maybe load the problematic map in Tiled 1.8 to see if it show right?

DLDarren commented 1 year ago

Sorry for response so late. I'm using pyglet1.5.27. My GPU is GeForce MX250. I can't find Tiled < 1.9 because it just provide the latest version of Tiled.

ccanepa commented 1 year ago

all releases: https://github.com/mapeditor/tiled/releases

DLDarren commented 1 year ago

The map loaded in Tiled1.8.6 properly. I loaded the map in test\test_tmx.py to use my map. It looks good at first. However, it began to have black lines around the tiles when I started to move and cocos began to invoke set_focus(). when haven't move: image when have moved: image Also, I recognized that when I use an image source which is 1458 907 pixels, it has the problem like the original problem: image but the problem changed when I used the image source 120 120 pixels: image I just changed the picture's size and didn't changed any tiles or the tiledmap. Here's the screen shot of the map after ctrl+W. image In addition, My system is Windows10.