JSON data types(Sprite frame data type)

0 favourites
  • 3 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • I don’t know if this is a bug or an undocumented change.

    Before r376, if we have a JSON like this:

    	{
    	"animals":[
    	{"animal":"dog", "frame": "1"}
    ]	
    }
    
    

    And then, if we get that value from “frame” with JSON.Get(".frame"), let’s say to set a sprite frame animation, it will treat the “1” as an integer and will set the sprite animation to frame 1, doing a Implicit type conversion.

    But after r376, it only works if we have the “frame” value as an actual integer:

    	{
    	"animals":[
    	{"animal":"dog", "frame": 1}
    ]	
    }
    
    

    This can cause a few bugs if a developer, for some reason started doing as the first example.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Since r376 you can set animation frames by tag too, it is done by checking the type (set frame by number if number, set by tag if string). So this is intentional I think, but yea I have also seen a lot of people on the Construct Discord getting tripped up by this..

  • Since r376 you can set animation frames by tag too, it is done by checking the type (set frame by number if number, set by tag if string). So this is intentional I think, but yea I have also seen a lot of people on the Construct Discord getting tripped up by this..

    That makes sense. I appreciate the feedback.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)