atomicptr / openfl-tiled

openfl-tiled is a library which gives OpenFL developers the ability to use the TILED map editor.
Other
45 stars 21 forks source link

fixed iteration through all objects at getObjectByName #66

Closed jalbanesi closed 9 years ago

jalbanesi commented 9 years ago

this code only checked the first objects element

atomicptr commented 9 years ago

I don't see what you've "fixed". The iteration should work without the ".objects"

jalbanesi commented 9 years ago

I have a tmx with several objects, something like:

 <objectgroup name="objects">
  <object name="circuit" x="328" y="521">
   <polyline points="0,0 2,-240 19,-278 91,-303 114,-370 158,-397 442,-394 482,-370 500,-324 484,-281 442,-247 376,-230 352,-201 347,-7 333,23 305,50 263,54 241,31 225,1 200,15 192,209 161,241 93,256 14,232 -7,163 -1,-1"/>
  </object>
  <object name="start" x="305" y="518" width="40" height="13"/>
  <object name="checkpoint1" x="605" y="101" width="19" height="47"/>
  <object name="checkpoint2" x="651" y="407" width="48" height="25"/>
  <object name="checkpoint3" x="413" y="749" width="21" height="51"/>
 </objectgroup>

and this method iterates only in the first item.

Adding .objects fixes the issue, but maybe the bug is in the iterator code.

T1mL3arn commented 9 years ago

Iteration is broken. In some cases internal pointer not reseted correctly and I get wrong iteration. I tried read object from group twice, and null-error happens on second attempt. Standard haxe iteration is working fine. Thanks for that fix.

atomicptr commented 9 years ago

I'll merge it since it does more help than harm but the real problem isn't solved: The Iteration seems to be broken ;).