[cdc45d]: examples / templated-game / resources / game-data.exjson  Maximize  Restore  History

Download this file

99 lines (84 with data), 2.3 kB

/*

ExJson formatted file.  This is a custom extension of Json that includes:
    * keys and values can be strings without quotes.
    * You can make references to other objects, and make an object
        referenciable.
    * block and line comments, ala JavaScript.
    * multiple number interpretations ('_' in the middle of a number, ala
        Java 7, different prefixes (0x, 0b, 0o) to represent different
        radix)
    * Parenthesis contain a numeric expression that will be evaluated.
    * Angle brackets for 2 dimensional numeric data.
    * Support for parsing a string as a boolean.
    * line ends don't need comma separators, but both commas and semicolons
        are supported.
*/


{
    // static object - the template processor will add these to the available
    // constants
    $static: true

    int: [
        // int keyword: interpret all in this list as an integer constant
        // named by the referent object.
        @COLOR_BLACK
        @COLOR_BLUE
        @COLOR_RED
        @COLOR_GREEN
        @COLOR_ALPHA
    ]
}


{
    // Color data
    type: color,

    BLACK:  *COLOR_BLACK 0x000000,
    BLUE:   *COLOR_BLUE 0x0000ff,
    RED:    *COLOR_RED 0xff0000,
    GREEN:  *COLOR_GREEN 0x00ff00,
    ALPHA:  *COLOR_ALPHA 0x888888,
}


{
    // bitmap data
    type: bitmaps

    bitmaps: [
        *ENEMY1 < // list of lists
        0 1 0 0 1 0,
        1 1 1 1 1 1,
        1 0 1 1 0 1,
        0 1 0 0 1 0,
        0 0 1 1 0 0,
        >
        *ENEMY2 <
        0 0 1 0 0 0,
        0 1 1 1 0 0,
        1 1 0 1 0 1,
        1 1 0 1 0 1,
        0 1 1 1 1 1,
        >
    ]
}

{
    type: units

    units: [
        {
            $alias: [ UNIT_0_POS, UNIT_ALIEN ]
            hp: 600
            maxMovement: 50
            color: @COLOR_RED
            image: @ENEMY1
        }

        {
            $alias: [ UNIT_1_POS, UNIT_SNAIL ]
            hp: 10
            maxMovement: 1
            color: @COLOR_BLUE
            image: @ENEMY2
        }

        {
            $alias: [ UNIT_2_POS, UNIT_SAILBOAT ]
            hp: 100
            maxMovement: 20
            color: @COLOR_GREEN
            image: @ENEMY2
        }
    ]
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks