Menu

#40 Declarative level

ideas
open
nobody
None
2025-11-07
2025-11-07
No

Would enable safer download of custom levels.

{
    "name": "Test Challenge",
    "width": 800,
    "height": 450,
    "enter": { "x": 230, "y": 140 },
    "world": [
        {
            "type": "rectangle",
            "args": {
                "x": 400,
                "y": 450,
                "width": 800,
                "height": 20,
                "options": { 
                    "isStatic": true, 
                    "frictionStatic": 0.9999, 
                    "friction": 0.9999 
                }
            }
        },
        {
            "type": "polygon",
            "args": {
                "x": 400,
                "y": 490,
                "sides": 4,
                "radius": 155,
                "options": { 
                    "isStatic": true, 
                    "frictionStatic": 0.9999, 
                    "friction": 0.9999
                }
            },
            "rotate": 1.1
        },
        {
            "type": "rectangle",
            "args": {       
                "x": 790,
                "y": 225,
                "width": 20,
                "height": 450,
                "options": { 
                    "isStatic": true
                }
            }
        },
        {
            "type": "rectangle",
            "args": {
                "x": 10,
                "y": 225,
                "width": 20,
                "height": 450,
                "options": { 
                    "isStatic": true 
                }
            }
        },
        { 
            "type": "stack", 
            "args": {
                "x": 495, 
                "y": 50, 
                "columns": 12, 
                "rows": 6, 
                "columnGap": 0, 
                "rowGap": 0,
                "callback": {
                    "type": "polygon",
                    "args": {
                        "x": { "type": "variable", "name": "sqX" },
                        "y": { "type": "variable", "name": "sqY" },
                        "sides": 5,
                        "radius": 12,
                        "options": {
                            "render": { "fillStyle": "#888" }
                        }
                    }
                }
            },
            "lambda-args": [ "sqX", "sqY" ]
        }
    ],
    "solution": {
        "type": "position",
        "label": "enclosure",
        "left": 600, 
        "top": 0,
        "right": 800, 
        "bottom": 450
    },
    "reward": [
        {
            "type": "unlock",
            "level": "Another Test Challenge"
        },
        {
            "type": "item",
            "name": "airscrew",
            "count": 2
        }
    ]
}

Discussion


Log in to post a comment.