Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Bitsy Converter

A web application to convert Bitsy scripts into various formats (JSON and Arduboy, for now; others may come soon). · By haroldo-ok

How to Parse Sprites exported via JSON- Beginner to Programming and Game Dev

A topic by Plague created Mar 23, 2021 Views: 66 Replies: 1
Viewing posts 1 to 2

TLDR- How do I draw the sprites and maps used in JSON in a game engine. (I personally use Godot)

Howdy,  I've been doodling around in bitsy for a while now and I'm thinking of taking a bitsy game and making it a hub/beginning  area for another project. Through my googling i could see how dialog could be implemented, however, with the sprite data being there I wonder if there's a way those can be drawn without me just redoing them all by hand. 

Thank you for reading,

Fizzy, the Plague on Hunamity

Developer

Hello; the images used by both the sprites and the background tiles are both located on the "images" section of the JSON, structured as an object whose keys are the names of the images and whose values are tridimensional arrays containing the pixels of the image, the first dimensional being the frames, the second being the rows, and the third being the columns:

  "images": {

    "TIL_a": [

      [

        [1, 1, 1, 1, 1, 1, 1, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 1, 1, 0, 0, 1],

        [1, 0, 0, 1, 1, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 1, 1, 1, 1, 1, 1, 1]

      ]

    ],

    "TIL_b": [

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 1, 1, 0, 1, 1, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 1, 0, 1, 1, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 1, 1, 0, 1, 1, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 1, 0, 1, 1, 0, 0]

      ],

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 1, 0, 1, 1, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 1, 1, 0, 1, 1, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 1, 0, 1, 1, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 1, 1, 0, 1, 1, 0]

      ]

    ],

    "TIL_c": [

      [

        [0, 0, 1, 1, 1, 1, 1, 0],

        [0, 1, 0, 0, 0, 0, 1, 0],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 1, 0],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 1, 0],

        [0, 1, 0, 0, 0, 0, 0, 1],

        [0, 0, 1, 1, 1, 1, 1, 0]

      ]

    ],

    "TIL_d": [

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [1, 1, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 1, 0, 1, 0, 0, 0, 1],

        [1, 0, 0, 1, 1, 0, 1, 1],

        [1, 1, 0, 1, 1, 0, 1, 1],

        [0, 0, 0, 0, 0, 0, 0, 0]

      ]

    ],

    "SPR_A": [

      [

        [0, 0, 0, 1, 1, 0, 0, 0],

        [0, 0, 0, 1, 1, 0, 0, 0],

        [0, 0, 0, 1, 1, 0, 0, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 1, 1, 1, 1, 1, 1, 0],

        [1, 0, 1, 1, 1, 1, 0, 1],

        [0, 0, 1, 0, 0, 1, 0, 0],

        [0, 0, 1, 0, 0, 0, 0, 0]

      ],

      [

        [0, 0, 0, 1, 1, 0, 0, 0],

        [0, 0, 0, 1, 1, 0, 0, 0],

        [1, 0, 0, 1, 1, 0, 0, 1],

        [0, 1, 1, 1, 1, 1, 1, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 0, 1, 0, 0, 1, 0, 0],

        [0, 0, 0, 0, 0, 1, 0, 0]

      ]

    ],

    "SPR_a": [

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 0, 1, 0, 0, 0, 1],

        [0, 1, 1, 1, 0, 0, 0, 1],

        [0, 1, 1, 1, 0, 0, 1, 0],

        [0, 1, 1, 1, 1, 1, 0, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 0, 1, 0, 0, 1, 0, 0]

      ],

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 1, 0, 1, 0, 0, 0, 0],

        [0, 1, 1, 1, 0, 0, 0, 1],

        [0, 1, 1, 1, 0, 0, 0, 1],

        [0, 1, 1, 1, 0, 0, 1, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 1, 0, 0, 0, 0, 1, 0]

      ]

    ],

    "SPR_b": [

      [

        [0, 0, 0, 0, 0, 0, 0, 1],

        [0, 0, 0, 0, 0, 0, 0, 1],

        [0, 0, 0, 0, 0, 0, 0, 1],

        [0, 0, 0, 0, 0, 0, 0, 1],

        [1, 1, 1, 1, 1, 1, 1, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1],

        [1, 0, 0, 0, 0, 0, 0, 1]

      ]

    ],

    "ITM_0": [

      [

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0],

        [0, 0, 1, 1, 1, 1, 0, 0],

        [0, 1, 1, 0, 0, 1, 0, 0],

        [0, 0, 1, 0, 0, 1, 0, 0],

        [0, 0, 0, 1, 1, 0, 0, 0],

        [0, 0, 0, 0, 0, 0, 0, 0]

      ]

    ]

  }