Games Tiled json output (or X2TileMap bug?)

Discussion in 'Game Development' started by ac9ts, Sep 21, 2018.

  1. ac9ts

    ac9ts Active Member Licensed User

    I might have found a bug with X2TileMap or my settings for Tiled (v1.2.0) are incorrect.

    There appears to be a json parsing error on the output file from Tiled and I don't know if it is how I have Tiled set or if I need to call a different parser.

    This definition copied from one of the samples works:
    Code:
    "ellipse":true,
                     
    "height":109.333333333333,
                     
    "id":2,
                     
    "name":"circle",
                     
    "properties":
                        {
                         
    "antialias":true,
                         
    "body type":"dynamic",
                         
    "destroy if invisible":true,
                         
    "graphic file 1":"blue_donut_7.png",
                         
    "time to live (ms)":5000
                        
    },
                     "propertytypes":
                        {
                         "antialias":"bool",
                         "body type":"string",
                         "destroy if invisible":"bool",
                         "graphic file 1":"string",
                         "time to live (ms)":"int"
                        },
                     "rotation":0,
                     "type":"x2",
                     "visible":true,
                     "width":112,
                     "x":204,
                     "y":-30.6666666666667
    If I load the file containing this definition into Tiled and save it, the definition is re-formatted to:

    Code:
    "ellipse":true,
                     
    "height":109.333333333333,
                     
    "id":2,
                     
    "name":"circle",
                     
    "properties":[
                            {
                             
    "name":"antialias",
                             
    "type":"bool",
                             
    "value":true
                            
    }, 
                            {
                             "name":"body type",
                             "type":"string",
                             "value":"dynamic"
                            }, 
                            {
                             "name":"destroy if invisible",
                             "type":"bool",
                             "value":true
                            }, 
                            {
                             "name":"graphic file 1",
                             "type":"string",
                             "value":"blue_donut_7.png"
                            }, 
                            {
                             "name":"time to live (ms)",
                             "type":"int",
                             "value":5000
                            }],
                     "rotation":0,
                     "type":"x2",
                     "visible":true,
                     "width":112,
                     "x":204,
                     "y":-30.6666666666667
    which causes the following crash log:

    Code:
    Size scale: 1.33
    x2tilemap._parseobjectslayer (java line: 
    1376)
    java.lang.ClassCastException: java.util.ArrayList cannot be cast 
    to anywheresoftware.b4a.objects.collections.Map$MyMap
        at b4j.example.x2tilemap._parseobjectslayer(x2tilemap.java:
    1376)
        at b4j.example.x2tilemap._initialize(x2tilemap.java:
    1122)
        at b4j.example.game._initialize(game.java:
    104)
        at b4j.example.main._appstart(main.java:
    55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    77)
        at b4j.example.main.start(main.java:
    38)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$
    162(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$
    175(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$173(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    174(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$
    null$148(WinApplication.java:191)
        at java.lang.Thread.run(
    Thread.java:748)
     

    Attached Files:

  2. ac9ts

    ac9ts Active Member Licensed User

    Down grading to Tiled v1.1.6 is the workaround. Using v1.2.0 appears to default to the unusable output format.
     
    inakigarm likes this.
  3. DonManfred

    DonManfred Expert Licensed User

    in the second properties is a List of Maps. Not a Map.
     
  4. inakigarm

    inakigarm Well-Known Member Licensed User

    Yes, I've downloaded another version and wasted many time trying to fix the errors ;-(
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Peter Simpson, Gunther, ac9ts and 2 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice