A Gravity Platformer
@Stage\n\n@Tile\n\nwhen flag clicked\nhide\nset [level v] to [1]\nbroadcast (gameLoad v)\n\ndefine Map width: (width) height: (height) Camera X: (x) Y: (y) Map: (map)\ndelete all of [tilemap v]\ndelete all of [tilecostume v]\ndelete all of [light v]\ndelete all of [spawngameobject v]\ndelete all of [gameobject v]\ndelete all of [message v]\ndelete all of [explains v]\ndelete all of [spawnexplains v]\nset [tilemapcounter v] to [0]\nif <(map) = [empty]> then\n    set [private mapempty v] to [1]\n    set [tilewidth v] to (width)\n    set [tileheight v] to (height)\nelse\n    set [private mapempty v] to [0]\n    repeat until <(tileMapCounter) = (length of (map))>\n        set [tilemaprecorder v] to []\n        repeat until <(letter ((tileMapCounter) + (1)) of (map)) = [/]>\n            change [tilemapcounter v] by (1)\n            set [tilemaprecorder v] to (join (tileMapRecorder) (letter (tileMapCounter) of (map)))\n        end\n        add (tileMapRecorder) to [tilemap v]\n        change [tilemapcounter v] by (1)\n    end\n    set [tilewidth v] to (item (1) of [tilemap v])\n    set [tileheight v] to (item (2) of [tilemap v])\nend\nset [tilewidthcounter v] to [0]\nset [tileheightcounter v] to [0]\nset [tilemapcounter v] to [2]\nrepeat (tileHeight)\n    repeat (tileWidth)\n        change [tilemapcounter v] by (1)\n        add [0] to [light v]\n        add [0] to [gameobject v]\n        add [0] to [explains v]\n        if <(map) = [empty]> then\n            add [1] to [tilecostume v]\n        else\n            add (item (tileMapCounter) of [tilemap v]) to [tilecostume v]\n        end\n        change [tilewidthcounter v] by (1)\n    end\n    change [tileheightcounter v] by (1)\n    set [tilewidthcounter v] to [0]\nend\nset [camerax v] to (x)\nset [cameray v] to (y)\nclear graphic effects\nerase all\nset [tilewidthcounter v] to [0]\nrepeat ((length of [tilecostume v]) + (1))\n    if <<((tileWidthCounter) mod (tileWidth)) = [0]> or <(<([ceiling v] of ((tileWidthCounter) / (tileWidth)) ) = [0]> + ([ceiling v] of ((tileWidthCounter) / (tileWidth)) )) = (tileHeight)>> then\n        replace item ((tileWidthCounter) + (1)) of [tilecostume v] with [2]\n    end\n    switch costume to (item ((tileWidthCounter) + (1)) of [tilecostume v])\n    go to x: ((((tileWidthCounter) mod (tileWidth)) * (16)) - (cameraX)) y: (((<([ceiling v] of ((tileWidthCounter) / (tileWidth)) ) = [0]> + ([ceiling v] of ((tileWidthCounter) / (tileWidth)) )) * (16)) - (cameraY))\n    stamp\n    change [tilewidthcounter v] by (1)\nend\nif <(tileWidthCounter) = ((length of [tilecostume v]) + (1))> then\n    replace item ((tileWidthCounter) - (1)) of [tilecostume v] with [2]\n    switch costume to (item ((tileWidthCounter) - (1)) of [tilecostume v])\n    stamp\nend\ndelete all of [tilemap v]\n\ndefine Update map\nclear graphic effects\nerase all\nset [tilewidthcounter v] to [0]\nrepeat ((length of [tilecostume v]) + (1))\n    if <(<([ceiling v] of ((tileWidthCounter) / (tileWidth)) ) = [0]> + ([ceiling v] of ((tileWidthCounter) / (tileWidth)) )) > [1]> then\n        set [brightness v] effect to ((item ((tileWidthCounter) + (1)) of [light v]) * (3))\n        set size to ((100) - ((item ((tileWidthCounter) + (1)) of [light v]) * (10))) %\n    end\n    switch costume to (item ((tileWidthCounter) + (1)) of [tilecostume v])\n    go to x: ((((tileWidthCounter) mod (tileWidth)) * (16)) - (cameraX)) y: (((<([ceiling v] of ((tileWidthCounter) / (tileWidth)) ) = [0]> + ([ceiling v] of ((tileWidthCounter) / (tileWidth)) )) * (16)) - (cameraY))\n    stamp\n    change [tilewidthcounter v] by (1)\n    if <((((tileWidthCounter) mod (tileWidth)) * (16)) - (cameraX)) < [256]> then\n        if <(item (tileWidthCounter) of [tilecostume v]) = [4]> then\n            replace item (tileWidthCounter) of [light v] with [2]\n            Light tile: (tileWidthCounter) index: [2] transmissible: [1]\n        end\n        if <(item (tileWidthCounter) of [tilecostume v]) = [5]> then\n            replace item (tileWidthCounter) of [light v] with [2]\n            Light tile: (tileWidthCounter) index: [2] transmissible: [1]\n        end\n        if <(item (tileWidthCounter) of [tilecostume v]) = [6]> then\n            replace item (tileWidthCounter) of [light v] with [4]\n            Light tile: (tileWidthCounter) index: [4] transmissible: [1]\n        end\n        if <(item (tileWidthCounter) of [tilecostume v]) = [11]> then\n            replace item (tileWidthCounter) of [light v] with [2]\n            Light tile: (tileWidthCounter) index: [2] transmissible: [1]\n        end\n    end\n    if <(item (tileWidthCounter) of [light v]) > [0]> then\n        replace item (tileWidthCounter) of [light v] with ((item (tileWidthCounter) of [light v]) - (0.5))\n    end\nend\n\nwhen [u v] key pressed\nif <(username) = [Thintin]> then\n    broadcast (editor v) and wait\n    stop [other scripts in sprite v]\n    set [camerax v] to ((round ((cameraX) / (16))) * (16))\n    set [cameray v] to ((round ((cameraY) / (16))) * (16))\n    wait until <not <key (u v) pressed?>>\n    show\n    repeat until <key (u v) pressed?>\n        go to x: ((round ((mouse x) / (16))) * (16)) y: ((round ((mouse y) / (16))) * (16))\n        if <key (y v) pressed?> then\n            wait until <not <key (y v) pressed?>>\n            switch costume to ((costume [number v]) - (1))\n        end\n        if <key (i v) pressed?> then\n            wait until <not <key (i v) pressed?>>\n            switch costume to ((costume [number v]) + (1))\n        end\n        if <key (w v) pressed?> then\n            change [cameray v] by ((round ((16) / (16))) * (16))\n            Update map\n        end\n        if <key (s v) pressed?> then\n            change [cameray v] by ((round ((-16) / (16))) * (16))\n            Update map\n        end\n        if <key (a v) pressed?> then\n            change [camerax v] by ((round ((-16) / (16))) * (16))\n            Update map\n        end\n        if <key (d v) pressed?> then\n            change [camerax v] by ((round ((16) / (16))) * (16))\n            Update map\n        end\n    end\n    Tile X: ((x position) + (cameraX)) Tile Y: ((y position) + (cameraY))\n    replace item (private tileIndex) of [tilecostume v] with (costume [number v])\n    Update map\n    hide\n    Save map\n    if <(private mapEmpty) = [0]> then\n        broadcast (gameOn v)\n    end\nend\n\ndefine Tile X: (tile x) Tile Y: (tile y)\nset [private tileindex v] to (((((tile x) / (16)) mod ((tileWidth) + (1))) + (1)) + (((((tile y) / (16)) mod (tileHeight)) * (tileWidth)) - (tileWidth)))\n\ndefine Save map\ndelete all of [tilemap v]\nadd (tileWidth) to [tilemap v]\nadd [/] to [tilemap v]\nadd (tileHeight) to [tilemap v]\nadd [/] to [tilemap v]\nset [tilewidthcounter v] to [0]\nrepeat (length of [tilecostume v])\n    change [tilewidthcounter v] by (1)\n    add (item (tileWidthCounter) of [tilecostume v]) to [tilemap v]\n    add [/] to [tilemap v]\nend\nset [tilewidthcounter v] to [0]\nrepeat (length of [tilemap v])\n    replace item (1) of [tilemap v] with (join (item (1) of [tilemap v]) (item (2) of [tilemap v]))\n    delete (2) of [tilemap v]\nend\n\nwhen I receive [gameload v]\nstop [other scripts in sprite v]\nif <(level) = [1]> then\n    Map width: [20] height: [20] Camera X: [80] Y: [108] Map: [20/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/1/1/3/2/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/2/2/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/2/2/3/2/2/2/1/1/1/1/4/2/2/2/2/1/1/1/1/1/2/2/2/2/3/2/1/1/1/1/4/2/2/2/2/1/1/1/1/1/2/2/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/3/2/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/2/2/2/2/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/5/5/5/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\n    Spawn gameObject type: [player] costume: [1] x: [32] y: [64] direction: [down] extra slot1: [] extra slot2: []\nend\nif <(level) = [2]> then\n    Map width: [20] height: [20] Camera X: [150] Y: [165] Map: [20/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/5/5/5/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/7/1/1/1/1/1/1/1/1/1/1/1/1/1/2/1/2/2/2/2/2/2/7/1/1/1/1/1/1/1/1/1/1/1/3/1/2/2/2/2/1/1/10/1/1/1/1/1/1/1/1/1/1/1/3/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/8/1/2/2/2/2/1/1/1/1/1/2/2/2/2/2/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/1/1/1/1/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/1/1/1/1/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/1/6/6/1/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/1/1/1/1/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/1/1/1/1/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/2/2/2/2/2/2/1/1/1/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/3/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/2/1/1/1/1/1/1/1/1/1/1/1/7/2/1/2/2/2/2/1/7/1/1/1/1/1/1/1/1/1/1/1/1/8/1/2/2/2/2/1/2/1/1/1/1/1/1/1/1/1/1/1/1/2/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\n    Spawn gameObject type: [player] costume: [1] x: [140] y: [172] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [box] costume: [1] x: [140] y: [275] direction: [right] extra slot1: [] extra slot2: []\nend\nif <(level) = [3]> then\n    Map width: [20] height: [20] Camera X: [150] Y: [165] Map: [20/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/2/2/2/2/2/2/2/1/2/3/2/2/10/2/2/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/2/2/1/1/5/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/2/2/1/1/5/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/2/2/1/1/5/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/3/2/1/1/5/2/2/2/2/2/2/2/2/2/1/2/2/2/3/2/2/1/1/2/9/2/2/2/2/1/2/2/2/2/1/2/2/1/2/2/2/7/1/1/1/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/2/2/2/2/1/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/7/2/2/2/1/2/2/2/2/1/1/1/2/2/1/2/2/1/1/1/3/2/2/2/1/2/2/2/7/1/1/1/9/2/1/2/3/1/1/1/2/2/2/2/1/2/2/2/2/2/2/2/2/2/1/2/2/2/2/2/2/2/2/2/1/2/2/2/2/10/2/2/2/2/1/2/2/2/2/2/2/2/10/2/1/2/2/2/2/1/1/1/8/2/1/1/1/1/1/1/1/1/1/1/1/7/2/2/2/1/1/1/2/2/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/1/1/2/2/1/1/1/1/1/1/1/1/1/2/1/2/2/2/7/1/1/1/2/2/1/1/1/1/1/1/1/1/1/7/1/2/2/2/2/2/2/9/2/2/10/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\n    Spawn gameObject type: [player] costume: [1] x: [32] y: [64] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [player] costume: [1] x: [180] y: [64] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [player] costume: [1] x: [64] y: [150] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [player] costume: [1] x: [180] y: [170] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [messager] costume: [2] x: [32] y: [32] direction: [down] extra slot1: [gate1] extra slot2: [up]\n    Spawn gameObject type: [messager] costume: [2] x: [32] y: [140] direction: [down] extra slot1: [gate2] extra slot2: [up]\n    Spawn gameObject type: [messager] costume: [2] x: [160] y: [32] direction: [down] extra slot1: [gate3] extra slot2: [up]\n    Spawn gameObject type: [messager] costume: [2] x: [160] y: [140] direction: [down] extra slot1: [gate4] extra slot2: [left]\n    Spawn gameObject type: [gate1] costume: [3] x: [112] y: [112] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate2] costume: [4] x: [112] y: [220] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [272] y: [220] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate4] costume: [6] x: [240] y: [112] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [box] costume: [1] x: [112] y: [64] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [box] costume: [1] x: [32] y: [250] direction: [down] extra slot1: [] extra slot2: []\nend\nif <(level) = [4]> then\n    Map width: [60] height: [20] Camera X: [160] Y: [165] Map: [60/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/8/4/4/4/4/4/4/4/4/2/2/2/2/2/2/4/4/4/4/4/4/4/4/4/2/2/2/2/2/8/4/4/4/4/4/4/2/2/2/2/2/2/8/4/4/4/4/4/4/4/2/2/2/2/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/5/5/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/5/5/2/7/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/3/1/1/1/3/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/5/5/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/5/5/2/2/1/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/5/5/2/2/4/4/4/4/4/4/4/4/2/2/2/2/2/7/4/4/4/4/4/4/4/4/4/2/2/3/2/2/7/4/4/4/4/4/4/4/4/2/2/2/7/4/4/4/4/4/4/4/4/4/4/2/2/10/10/10/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/10/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/8/2/10/1/1/1/1/1/1/8/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/8/1/1/1/10/1/1/1/1/2/1/1/1/1/7/2/2/2/1/1/1/1/1/8/2/2/2/2/2/9/2/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/2/2/2/2/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/8/1/1/1/1/2/1/1/1/1/1/1/1/1/2/2/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/4/2/2/1/1/1/1/1/1/1/1/1/1/1/1/10/1/1/1/1/1/1/1/8/1/1/1/1/1/1/1/1/1/8/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/4/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/7/1/10/2/1/1/2/10/2/2/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/4/2/2/1/1/1/1/1/2/2/1/2/8/1/1/1/1/1/1/1/8/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/4/2/2/1/1/1/1/1/2/2/1/2/2/1/9/1/10/1/1/1/2/1/9/2/2/2/2/1/1/1/1/1/1/1/1/1/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/4/4/2/2/2/2/10/2/2/2/2/1/2/2/1/1/1/7/7/1/1/1/1/1/1/2/2/2/1/1/1/1/1/1/1/1/1/7/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/4/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/10/2/2/2/2/2/10/2/9/2/2/2/2/2/2/10/2/2/2/10/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\n    Spawn gameObject type: [box] costume: [1] x: [32] y: [190] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [messager] costume: [2] x: [64] y: [190] direction: [right] extra slot1: [gate1] extra slot2: [delete]\n    Spawn gameObject type: [box] costume: [1] x: [145] y: [280] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate1] costume: [3] x: [145] y: [256] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [messager] costume: [2] x: [140] y: [200] direction: [right] extra slot1: [gate2] extra slot2: [up]\n    Spawn gameObject type: [gate2] costume: [4] x: [288] y: [178] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate2] costume: [4] x: [288] y: [200] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [messager] costume: [2] x: [400] y: [190] direction: [right] extra slot1: [gate3] extra slot2: [delete]\n    Spawn gameObject type: [player] costume: [1] x: [40] y: [64] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [585] y: [64] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [585] y: [80] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [585] y: [96] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [585] y: [112] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [5] x: [585] y: [128] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [gate3] costume: [6] x: [590] y: [240] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [box] costume: [1] x: [565] y: [240] direction: [right] extra slot1: [] extra slot2: []\nend\nif <(level) = [5]> then\n    Map width: [20] height: [20] Camera X: [160] Y: [165] Map: [20/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/2/1/2/2/2/2/2/2/2/2/2/2/2/1/2/2/2/2/10/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/11/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/10/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/8/2/2/2/2/2/1/2/2/2/2/2/2/2/2/2/2/2/2/1/2/2/2/2/2/2/1/2/1/1/1/1/1/1/1/1/1/1/2/1/2/2/2/2/2/2/1/2/1/1/1/1/1/1/1/1/1/1/2/1/2/5/2/2/1/1/1/2/1/1/1/1/1/1/1/1/1/1/2/1/1/1/2/2/1/1/1/2/1/1/1/1/1/1/1/1/1/1/2/1/1/1/2/2/1/1/1/2/1/1/1/1/1/1/1/1/1/1/2/1/1/1/2/2/1/1/1/2/1/1/1/1/1/1/1/1/1/1/2/1/1/1/2/2/2/2/1/2/2/2/2/2/2/2/2/2/2/2/2/1/2/7/2/2/2/7/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/2/1/2/2/2/2/2/2/2/2/2/2/2/2/9/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\n    Spawn gameObject type: [messager] costume: [2] x: [288] y: [288] direction: [right] extra slot1: [boxSpawner] extra slot2: [37]\n    Spawn gameObject type: [sideMessager] costume: [7] x: [32] y: [32] direction: [right] extra slot1: [boxDestroyer] extra slot2: [304]\n    Spawn gameObject type: [sideMessager] costume: [7] x: [64] y: [32] direction: [right] extra slot1: [boxDestroyer] extra slot2: [298]\n    Spawn gameObject type: [boxSpawner] costume: [8] x: [256] y: [32] direction: [down] extra slot1: [up] extra slot2: [left]\n    Spawn gameObject type: [player] costume: [1] x: [240] y: [288] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [boxDestroyer] costume: [9] x: [48] y: [256] direction: [up] extra slot1: [0] extra slot2: [-16]\n    Spawn gameObject type: [boxDestroyer] costume: [9] x: [272] y: [240] direction: [right] extra slot1: [-16] extra slot2: [0]\n    Spawn gameObject type: [player] costume: [1] x: [25] y: [160] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [112] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [128] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [144] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [160] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [176] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [192] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [208] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [224] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [48] y: [240] direction: [down] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [64] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [80] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [96] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [112] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [128] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [130] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [146] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [162] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [178] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [194] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [210] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [226] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [242] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [258] y: [240] direction: [left] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [224] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [208] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [192] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [176] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [160] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [144] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [128] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [112] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [256] y: [96] direction: [up] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [240] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [224] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [208] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [192] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [176] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [160] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [144] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [128] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [112] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [96] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [80] y: [96] direction: [right] extra slot1: [] extra slot2: []\n    Spawn gameObject type: [fireBox] costume: [10] x: [64] y: [96] direction: [right] extra slot1: [] extra slot2: []\nend\nif <(level) = [6]> then\n    Map width: [20] height: [20] Camera X: [160] Y: [165] Map: [20/20/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/5/1/1/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/5/5/5/1/1/1/2/2/2/2/1/1/1/1/1/1/3/1/1/5/5/5/5/5/1/1/2/2/2/2/1/1/1/1/1/3/3/3/1/1/5/5/5/1/1/1/2/2/2/2/1/1/1/4/1/1/3/1/1/1/1/5/1/1/1/1/2/2/2/2/1/1/4/4/4/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/4/4/4/4/4/1/1/1/1/1/2/1/1/1/1/2/2/2/2/1/1/4/1/4/1/1/1/1/1/1/2/1/1/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/2/1/1/1/1/2/2/2/2/1/1/2/1/2/1/1/1/2/1/1/2/2/2/1/1/2/2/2/2/1/2/1/2/1/2/1/1/2/1/1/2/1/1/2/1/2/2/2/2/1/2/1/2/1/2/1/1/2/1/1/2/1/1/2/1/2/2/2/2/1/2/1/1/1/2/1/1/2/1/1/1/2/2/2/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/2/]\nend\nif <(private mapEmpty) = [0]> then\n    broadcast (gameOn v)\nend\n\nwhen I receive [gameon v]\nforever\n    Update map\nend\n\nwhen [space v] key pressed\nif <(username) = [Thintin]> then\n    if <(playerPhysicToggle) = [0]> then\n        set [playerphysictoggle v] to [1]\n    else\n        set [playerphysictoggle v] to [0]\n    end\n    show variable [playerphysictoggle v]\n    wait until <not <key (space v) pressed?>>\n    hide variable [playerphysictoggle v]\nend\n\ndefine Light tile: (tile) index: (index) transmissible: (0/1)\nif <((item (tile) of [light v]) - (1)) > [0]> then\n    replace item (index) of [light v] with (index)\nend\nif <(0/1) = [0]> then\n    if <(item ((tile) + (1)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (1)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (1)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (1)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) + (-1)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (-1)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (-1)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (-1)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) + (tileWidth)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (tileWidth)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (tileWidth)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) - (tileWidth)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) - (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) - (tileWidth)) of [light v] with ((index) - (1))\n            Light tile: ((tile) - (tileWidth)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\nelse\n    if <(item ((tile) + (1)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (1)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (1)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) + (-1)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (-1)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (-1)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) + (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (tileWidth)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (tileWidth)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) - (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) - (tileWidth)) of [light v] with ((index) - (1))\n        Light tile: ((tile) - (tileWidth)) index: ((index) - (1)) transmissible: [1]\n    end\nend\n\ndefine Spawn gameObject type: (<t>) costume: (costume) x: (x) y: (y) direction: (direction) extra slot1: (value1) extra slot2: (value2)\nadd (<t>) to [spawngameobject v]\nadd (costume) to [spawngameobject v]\nadd (x) to [spawngameobject v]\nadd (y) to [spawngameobject v]\nadd (direction) to [spawngameobject v]\nadd (value1) to [spawngameobject v]\nadd (value2) to [spawngameobject v]\n\nset [level v] to [4]\nbroadcast (gameLoad v)\n\nwhen [r v] key pressed\nbroadcast (gameLoad v)\n\n@Player\n\ndefine Tile X: (tile x) Tile Y: (tile y)\nset [private tileindex v] to (((((tile x) / (16)) mod ((tileWidth) + (1))) + (1)) + (((((tile y) / (16)) mod (tileHeight)) * (tileWidth)) - (tileWidth)))\n\ndefine Player move X: (x) Y: (y)\nTile X: ((round ((((round ((private playerX) / (16))) * (16)) + (x)) / (16))) * (16)) Tile Y: ((round ((((round ((private playerY) / (16))) * (16)) + (y)) / (16))) * (16))\nif <<(private tileIndex) > [0]> and <(item (private tileIndex) of [tilecostume v]) = [1]>> then\n    if <<(private playerDirection) = [down]> or <(private playerDirection) = [up]>> then\n        change [private playerx v] by ((x) * (0.25))\n        change [private playery v] by ((y) * (0.2))\n    else\n        change [private playerx v] by ((x) * (0.2))\n        change [private playery v] by ((y) * (0.25))\n    end\nend\n\nwhen I receive [gameon v]\nset [globalobjectdelete v] to [0]\nforever\n    if <(private playerSpot) = [origin]> then\n        if <(length of [spawngameobject v]) > [0]> then\n            gameObjectLoad\n        end\n    end\nend\n\nwhen I receive [gameload v]\nstop [other scripts in sprite v]\ndelete this clone\n\ndefine Dectect player tile. Define up: (upx) (upy) down: (downx) (downy) left: (leftx) (lefty) right: (rightx) (righty)\nset [private direction set v] to [0]\nTile X: ((round (((private playerX) + (downx)) / (16))) * (16)) Tile Y: ((round (((private playerY) + (downy)) / (16))) * (16))\nif <(private playerSpot) = (globalObjectDelete)> then\n    set [globalobjectdelete v] to [0]\n    stop [other scripts in sprite v]\n    replace item (private playerSpot) of [gameobject v] with [0]\n    replace item (private playerSpot) of [light v] with [10]\n    Light tile: (private playerSpot) index: [10] transmissible: [0]\n    delete this clone\nend\nif <<not <(private tileIndex) > [0]>> or <(item (private playerBelowTile) of [tilecostume v]) = [4]>> then\n    broadcast (gameLoad v)\nelse\n    if <(item (private playerBelowTile) of [tilecostume v]) = [5]> then\n        change [level v] by (1)\n        broadcast (gameLoad v)\n    else\n        if <(item (private playerBelowTile) of [tilecostume v]) = [7]> then\n            set [private playerbelowtile v] to (private tileIndex)\n            set [private playerdirection v] to [down]\n        else\n            if <(item (private playerBelowTile) of [tilecostume v]) = [8]> then\n                set [private playerbelowtile v] to (private tileIndex)\n                set [private playerdirection v] to [up]\n            else\n                if <(item (private playerBelowTile) of [tilecostume v]) = [9]> then\n                    set [private playerbelowtile v] to (private tileIndex)\n                    set [private playerdirection v] to [left]\n                else\n                    if <(item (private playerBelowTile) of [tilecostume v]) = [10]> then\n                        set [private playerbelowtile v] to (private tileIndex)\n                        set [private playerdirection v] to [right]\n                    else\n                        if <(item (private playerBelowTile) of [tilecostume v]) = [11]> then\n                            stop [other scripts in sprite v]\n                            replace item (private playerSpot) of [gameobject v] with [0]\n                            delete this clone\n                        else\n                            set [private playerbelowtile v] to (private tileIndex)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nTile X: ((round (((private playerX) + (upx)) / (16))) * (16)) Tile Y: ((round (((private playerY) + (upy)) / (16))) * (16))\nset [private playerabovetile v] to (private tileIndex)\nTile X: ((round (((private playerX) + (leftx)) / (16))) * (16)) Tile Y: ((round (((private playerY) + (lefty)) / (16))) * (16))\nset [private playerlefttile v] to (private tileIndex)\nTile X: ((round (((private playerX) + (rightx)) / (16))) * (16)) Tile Y: ((round (((private playerY) + (righty)) / (16))) * (16))\nset [private playerrighttile v] to (private tileIndex)\nRelative direction: [down] Environment: [up] [left] [right] Environment numbers: [0] [16] [-16] [0] [16] [0]\nRelative direction: [up] Environment: [down] [right] [left] Environment numbers: [0] [-16] [16] [0] [-16] [0]\nRelative direction: [right] Environment: [left] [down] [up] Environment numbers: [16] [0] [0] [16] [0] [-16]\nRelative direction: [left] Environment: [right] [up] [down] Environment numbers: [-16] [0] [0] [-16] [0] [16]\n\ndefine Fix Y-axis: (repeatnum) (x) (y)\nif <(repeatnum) = [tillGround]> then\n    repeat until <<not <(item (private playerBelowTile) of [gameobject v]) = [0]>> or <not <(item (private playerBelowTile) of [tilecostume v]) = [1]>>>\n        Player move X: ((x) * (-1)) Y: ((y) * (-1))\n    end\n    if <<(private playerDirection) = [up]> or <(private playerDirection) = [down]>> then\n        set [private playery v] to ((round ((private playerY) / (16))) * (16))\n    else\n        set [private playerx v] to ((round ((private playerX) / (16))) * (16))\n    end\nelse\n    repeat (repeatnum)\n        if <(item (private playerAboveTile) of [gameobject v]) = [0]> then\n            Player move X: (x) Y: (y)\n        end\n    end\n    if <<(private playerDirection) = [up]> or <(private playerDirection) = [down]>> then\n        set [private playery v] to ((round ((private playerY) / (16))) * (16))\n    else\n        set [private playerx v] to ((round ((private playerX) / (16))) * (16))\n    end\nend\n\ndefine Left key: (left1) (left2) Right key: (right1) (right2) Left: (leftx) (lefty) Right: (rightx) (righty)\nif <<key ((left1) v) pressed?> or <key ((left2) v) pressed?>> then\n    if <(item (private playerLeftTile) of [gameobject v]) = [0]> then\n        Player move X: (leftx) Y: (lefty)\n    end\nend\nif <<key ((right1) v) pressed?> or <key ((right2) v) pressed?>> then\n    if <(item (private playerRightTile) of [gameobject v]) = [0]> then\n        Player move X: (rightx) Y: (righty)\n    end\nend\n\ndefine Up key: (up1) (up2) Up: (upx) (upy)\nif <<not <(item (private playerBelowTile) of [tilecostume v]) = [1]>> or <not <(item (private playerBelowTile) of [gameobject v]) = [0]>>> then\n    if <<key ((up1) v) pressed?> or <key ((up2) v) pressed?>> then\n        if <(item (private playerBelowTile) of [tilecostume v]) = [6]> then\n            set [playerglobaldirection v] to (private playerDirection)\n            broadcast (globalDirection v)\n        end\n        if <(item (private playerBelowTile) of [gameobject v]) = [messager]> then\n            broadcast (globalMessagerCheck v)\n        end\n        replace item (private playerBelowTile) of [light v] with [10]\n        Light tile: (private playerBelowTile) index: [10] transmissible: [0]\n        Fix Y-axis: [8] (upx) (upy)\n    end\nend\n\ndefine Relative direction: (direction) Environment: (1) (2) (3) Environment numbers: (e1) (e2) (e3) (e4) (e5) (e6)\nif <(private direction set) = [0]> then\n    if <(private playerDirection) = (direction)> then\n        replace item (private playerSpot) of [gameobject v] with [0]\n        set [private playerspot v] to ((private playerBelowTile) + (((e1) / (16)) + (((e2) * (tileWidth)) / (16))))\n        if <(private playerDirection) = [left]> then\n            change [private playerspot v] by (2)\n        end\n        if <(private playerDirection) = [right]> then\n            change [private playerspot v] by (-2)\n        end\n        replace item (private playerSpot) of [gameobject v] with (private playerType)\n        if <<(item (private playerBelowTile) of [tilecostume v]) = [3]> or <(item (private playerBelowTile) of [tilecostume v]) = [6]>> then\n            if <(item (private playerBelowTile) of [explains v]) = [0]> then\n                add (private playerBelowTile) to [spawnexplains v]\n                add (item (private playerBelowTile) of [tilecostume v]) to [spawnexplains v]\n            end\n        end\n        if <<(item (private playerAboveTile) of [tilecostume v]) = [3]> or <(item (private playerAboveTile) of [tilecostume v]) = [6]>> then\n            set [private direction set v] to [1]\n            set [private playerdirection v] to (1)\n            if <(item (private playerAboveTile) of [explains v]) = [0]> then\n                add (private playerAboveTile) to [spawnexplains v]\n                add (item (private playerAboveTile) of [tilecostume v]) to [spawnexplains v]\n            end\n        else\n            if <<(item (private playerLeftTile) of [tilecostume v]) = [3]> or <(item (private playerLeftTile) of [tilecostume v]) = [6]>> then\n                set [private direction set v] to [1]\n                set [private playerdirection v] to (2)\n                if <(item (private playerLeftTile) of [explains v]) = [0]> then\n                    add (private playerLeftTile) to [spawnexplains v]\n                    add (item (private playerLeftTile) of [tilecostume v]) to [spawnexplains v]\n                end\n            else\n                if <<(item (private playerRightTile) of [tilecostume v]) = [3]> or <(item (private playerRightTile) of [tilecostume v]) = [6]>> then\n                    set [private direction set v] to [1]\n                    set [private playerdirection v] to (3)\n                    if <(item (private playerRightTile) of [explains v]) = [0]> then\n                        add (private playerRightTile) to [spawnexplains v]\n                        add (item (private playerRightTile) of [tilecostume v]) to [spawnexplains v]\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [editor v]\nstop [other scripts in sprite v]\ndelete this clone\n\ndefine Light tile: (tile) index: (index) transmissible: (0/1)\nif <((item (tile) of [light v]) - (1)) > [0]> then\n    replace item (index) of [light v] with (index)\nend\nif <(0/1) = [0]> then\n    if <(item ((tile) + (1)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (1)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (1)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (1)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) + (-1)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (-1)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (-1)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (-1)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) + (tileWidth)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) + (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) + (tileWidth)) of [light v] with ((index) - (1))\n            Light tile: ((tile) + (tileWidth)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\n    if <(item ((tile) - (tileWidth)) of [tilecostume v]) = (item (tile) of [tilecostume v])> then\n        if <(item ((tile) - (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n            replace item ((tile) - (tileWidth)) of [light v] with ((index) - (1))\n            Light tile: ((tile) - (tileWidth)) index: ((index) - (1)) transmissible: [0]\n        end\n    end\nelse\n    if <(item ((tile) + (1)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (1)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (1)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) + (-1)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (-1)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (-1)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) + (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) + (tileWidth)) of [light v] with ((index) - (1))\n        Light tile: ((tile) + (tileWidth)) index: ((index) - (1)) transmissible: [1]\n    end\n    if <(item ((tile) - (tileWidth)) of [light v]) < (item (tile) of [light v])> then\n        replace item ((tile) - (tileWidth)) of [light v] with ((index) - (1))\n        Light tile: ((tile) - (tileWidth)) index: ((index) - (1)) transmissible: [1]\n    end\nend\n\nwhen I start as a clone\ngo to x: ((private playerX) - (cameraX)) y: ((private playerY) - (cameraY))\nshow\nwait until <(length of [spawngameobject v]) = [0]>\nforever\n    if <(playerPhysicToggle) = [1]> then\n        go to x: ((private playerX) - (cameraX)) y: ((private playerY) - (cameraY))\n        if <not <(private playerType) = [player]>> then\n            if <(item (private playerBelowTile) of [gameobject v]) = [messager]> then\n                broadcast (globalMessagerCheck v)\n            end\n            if <<(item (private playerLeftTile) of [gameobject v]) = [sideMessager]> or <(item (private playerRightTile) of [gameobject v]) = [sideMessager]>> then\n                broadcast (globalSideMessagerCheck v)\n            end\n        end\n        if <(private playerDirection) = [down]> then\n            Dectect player tile. Define up: [0] [16] down: [0] [-16] left: [-16] [0] right: [16] [0]\n        else\n            if <(private playerDirection) = [up]> then\n                Dectect player tile. Define up: [0] [-16] down: [0] [16] left: [16] [0] right: [-16] [0]\n            else\n                if <(private playerDirection) = [left]> then\n                    Dectect player tile. Define up: [16] [0] down: [-16] [0] left: [0] [16] right: [0] [-16]\n                else\n                    Dectect player tile. Define up: [-16] [0] down: [16] [0] left: [0] [-16] right: [0] [16]\n                end\n            end\n        end\n        if <(private playerType) = [player]> then\n            if <(private playerDirection) = [down]> then\n                Left key: [a] [left arrow] Right key: [d] [right arrow] Left: [-16] [0] Right: [16] [0]\n            else\n                if <(private playerDirection) = [up]> then\n                    Left key: [a] [left arrow] Right key: [d] [right arrow] Left: [16] [0] Right: [-16] [0]\n                else\n                    if <(private playerDirection) = [left]> then\n                        Left key: [a] [left arrow] Right key: [d] [right arrow] Left: [0] [16] Right: [0] [-16]\n                    else\n                        Left key: [a] [left arrow] Right key: [d] [right arrow] Left: [0] [-16] Right: [0] [16]\n                    end\n                end\n            end\n            if <((private playerX) - (cameraX)) > [132]> then\n                change [camerax v] by (8)\n            end\n            if <((private playerX) - (cameraX)) < [-132]> then\n                change [camerax v] by (-8)\n            end\n            if <((private playerY) - (cameraY)) > [132]> then\n                change [cameray v] by (8)\n            end\n            if <((private playerY) - (cameraY)) < [-132]> then\n                change [cameray v] by (-8)\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nwait until <(length of [spawngameobject v]) = [0]>\nforever\n    if <(playerPhysicToggle) = [1]> then\n        if <(private playerType) = [messager]> then\n            if <(item (private playerAboveTile) of [gameobject v]) = [player]> then\n                if <(item (private playerAboveTile) of [explains v]) = [0]> then\n                    add (private playerAboveTile) to [spawnexplains v]\n                    add [messager] to [spawnexplains v]\n                    add (private playerAboveTile) to [spawnexplains v]\n                    add (private slot1) to [spawnexplains v]\n                end\n            end\n        else\n            if <(private playerType) = [fireBox]> then\n                replace item (private playerSpot) of [light v] with [3]\n                Light tile: (private playerSpot) index: [3] transmissible: [1]\n                if <(item (private playerBelowTile) of [gameobject v]) = [player]> then\n                    broadcast (gameLoad v)\n                end\n            else\n                if <(private playerType) = [boxDestroyer]> then\n                    if <(item (1) of [message v]) = (private playerType)> then\n                        if <(item (2) of [message v]) = (private playerSpot)> then\n                            wait until <not <(item ((private playerSpot) + (((private slot1) / (16)) + (((private slot2) * (tileWidth)) / (16)))) of [gameobject v]) = [0]>>\n                            set [globalobjectdelete v] to ((private playerSpot) + (((private slot1) / (16)) + (((private slot2) * (tileWidth)) / (16))))\n                            repeat (10)\n                                change size by (10)\n                                turn right (10) degrees\n                                if <(item (private playerAboveTile) of [explains v]) = [0]> then\n                                    add (private playerAboveTile) to [spawnexplains v]\n                                    add [destroyed] to [spawnexplains v]\n                                end\n                            end\n                            repeat (10)\n                                change size by (-10)\n                                turn right (-10) degrees\n                            end\n                            point in direction (90)\n                            set size to (100) %\n                        end\n                    end\n                else\n                    if <(private playerType) = [boxSpawner]> then\n                        if <(item (1) of [message v]) = (private playerType)> then\n                            if <(item (2) of [message v]) = (private playerSpot)> then\n                                add [box] to [spawngameobject v]\n                                add [1] to [spawngameobject v]\n                                if <(private slot1) = [up]> then\n                                    add ((private playerX) + (0)) to [spawngameobject v]\n                                    add ((private playerY) + (16)) to [spawngameobject v]\n                                else\n                                    if <(private slot1) = [down]> then\n                                        add ((private playerX) + (0)) to [spawngameobject v]\n                                        add ((private playerY) + (-16)) to [spawngameobject v]\n                                    else\n                                        if <(private slot1) = [left]> then\n                                            add ((private playerX) + (-16)) to [spawngameobject v]\n                                            add ((private playerY) + (0)) to [spawngameobject v]\n                                        else\n                                            add ((private playerX) + (16)) to [spawngameobject v]\n                                            add ((private playerY) + (0)) to [spawngameobject v]\n                                        end\n                                    end\n                                end\n                                add (private slot2) to [spawngameobject v]\n                                add [] to [spawngameobject v]\n                                add [] to [spawngameobject v]\n                            end\n                        end\n                    else\n                        if < (private playerType) contains [gate]?> then\n                            if <(item (1) of [message v]) = (private playerType)> then\n                                if <(item (2) of [message v]) = [delete]> then\n                                    stop [other scripts in sprite v]\n                                    replace item (private playerSpot) of [gameobject v] with [0]\n                                    delete this clone\n                                else\n                                    set [private playerdirection v] to (item (2) of [message v])\n                                    set [private playertype v] to [box]\n                                end\n                            end\n                        else\n                            if <(private playerType) = [player]> then\n                                if <(item (1) of [message v]) = (private playerType)> then\n                                    set [private playerdirection v] to (item (2) of [message v])\n                                end\n                                if <(private playerDirection) = [up]> then\n                                    Up key: [w] [up arrow] Up: [0] [-16]\n                                else\n                                    if <(private playerDirection) = [down]> then\n                                        Up key: [w] [up arrow] Up: [0] [16]\n                                    else\n                                        if <(private playerDirection) = [left]> then\n                                            Up key: [w] [up arrow] Up: [16] [0]\n                                        else\n                                            if <(private playerDirection) = [right]> then\n                                                Up key: [w] [up arrow] Up: [-16] [0]\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        if <not < (private playerType) contains [gate]?>> then\n            if <(private playerDirection) = [up]> then\n                Fix Y-axis: [tillGround] [0] [-16]\n            else\n                if <(private playerDirection) = [down]> then\n                    Fix Y-axis: [tillGround] [0] [16]\n                else\n                    if <(private playerDirection) = [left]> then\n                        Fix Y-axis: [tillGround] [16] [0]\n                    else\n                        if <(private playerDirection) = [right]> then\n                            Fix Y-axis: [tillGround] [-16] [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [globaldirection v]\nif <<<not <(private playerSpot) = [origin]>> and <not <(private playerType) = [player]>>> and <not < (private playerType) contains [gate]?>>> then\n    if <not <(item (private playerBelowTile) of [tilecostume v]) = [1]>> then\n        replace item (private playerBelowTile) of [light v] with [10]\n        Light tile: (private playerBelowTile) index: [10] transmissible: [0]\n        set [private playerdirection v] to (playerGlobalDirection)\n        Object direction renew\n    end\nend\n\nwhen flag clicked\nset [private playerspot v] to [origin]\n\ndefine Update object. X: (x) y: (y)\nif <<(item ((((((round (((private playerX) + (x)) / (16))) * (16)) / (16)) mod ((tileWidth) + (1))) + (1)) + ((((((round (((private playerY) + (y)) / (16))) * (16)) / (16)) mod (tileHeight)) * (tileWidth)) - (tileWidth))) of [tilecostume v]) = [1]> and <(item ((((((round (((private playerX) + (x)) / (16))) * (16)) / (16)) mod ((tileWidth) + (1))) + (1)) + ((((((round (((private playerY) + (y)) / (16))) * (16)) / (16)) mod (tileHeight)) * (tileWidth)) - (tileWidth))) of [gameobject v]) = [0]>> then\n    replace item (private playerSpot) of [gameobject v] with [0]\n    Spawn gameObject type: (private playerType) costume: (costume [number v]) x: (((round ((private playerX) / (16))) * (16)) + (x)) y: (((round ((private playerY) / (16))) * (16)) + (y)) direction: (private playerDirection) extra slot1: (private slot1) extra slot2: (private slot2)\n    stop [other scripts in sprite v]\n    delete this clone\nend\n\ndefine Object direction renew\nreplace item (private playerSpot) of [gameobject v] with [0]\nif <(private playerDirection) = [up]> then\n    Update object. X: [0] y: [16]\nelse\n    if <(private playerDirection) = [down]> then\n        Update object. X: [0] y: [-16]\n    else\n        if <(private playerDirection) = [left]> then\n            Update object. X: [-16] y: [0]\n        else\n            if <(private playerDirection) = [right]> then\n                Update object. X: [16] y: [0]\n            end\n        end\n    end\nend\n\ndefine Spawn gameObject type: (<t>) costume: (costume) x: (x) y: (y) direction: (direction) extra slot1: (value1) extra slot2: (value2)\nadd (<t>) to [spawngameobject v]\nadd (costume) to [spawngameobject v]\nadd (x) to [spawngameobject v]\nadd (y) to [spawngameobject v]\nadd (direction) to [spawngameobject v]\nadd (value1) to [spawngameobject v]\nadd (value2) to [spawngameobject v]\n\nwhen I receive [globalmessagercheck v]\nif <not <(private playerSpot) = [origin]>> then\n    if <(private playerType) = [messager]> then\n        if <not <(item (private playerAboveTile) of [gameobject v]) = [0]>> then\n            if <<[gameobject v] contains (private slot1)?> and <not <[message v] contains (private slot1)?>>> then\n                add (private slot1) to [message v]\n                add (private slot2) to [message v]\n            end\n        end\n    end\nend\n\nwhen I receive [globalsidemessagercheck v]\nif <not <(private playerSpot) = [origin]>> then\n    if <(private playerType) = [sideMessager]> then\n        if <<not <(item (private playerLeftTile) of [gameobject v]) = [0]>> or <not <(item (private playerRightTile) of [gameobject v]) = [0]>>> then\n            if <<[gameobject v] contains (private slot1)?> and <not <[message v] contains (private slot1)?>>> then\n                add (private slot1) to [message v]\n                add (private slot2) to [message v]\n            end\n        end\n    end\nend\n\nwhen I receive [gameon v]\nforever\n    if <(private playerSpot) = [origin]> then\n        if <(length of [message v]) > [0]> then\n            wait (0.1) seconds\n            delete (1) of [message v]\n            delete (1) of [message v]\n        end\n    end\nend\n\ndefine gameObjectLoad\nset [private playerbelowtile v] to [-]\nset [private playerabovetile v] to [-]\nset [private playerlefttile v] to [-]\nset [private playerrighttile v] to [-]\nset [spawnplayercounter v] to [0]\nrepeat ((length of [spawngameobject v]) / (7))\n    change [spawnplayercounter v] by (1)\n    set [private playertype v] to (item (spawnPlayerCounter) of [spawngameobject v])\n    switch costume to (item ((spawnPlayerCounter) + (1)) of [spawngameobject v])\n    set [private playerx v] to (item ((spawnPlayerCounter) + (2)) of [spawngameobject v])\n    set [private playery v] to (item ((spawnPlayerCounter) + (3)) of [spawngameobject v])\n    set [private playerdirection v] to (item ((spawnPlayerCounter) + (4)) of [spawngameobject v])\n    set [private slot1 v] to (item ((spawnPlayerCounter) + (5)) of [spawngameobject v])\n    set [private slot2 v] to (item ((spawnPlayerCounter) + (6)) of [spawngameobject v])\n    create clone of (_myself_ v)\n    change [spawnplayercounter v] by (6)\nend\ndelete all of [spawngameobject v]\n\n@FPS\n\nwhen flag clicked\nhide\nforever\n    change [fpscounter v] by (1)\n    wait (0) seconds\n    if <(timer) > [1]> then\n        reset timer\n        set [fps v] to (fpsCounter)\n        set [fpscounter v] to [0]\n    end\nend\n\nwhen I receive [fpsupdate v]\nif <not <(costume [name v]) = [a]>> then\n    delete this clone\nend\nfpsLoad\n\nwhen I start as a clone\nset [ghost v] effect to (50)\nshow\n\nwhen flag clicked\nforever\n    broadcast (fpsUpdate v)\nend\n\nwait (1) seconds\n\ndefine fpsLoad\ngo to x: (0) y: (0)\nset size to (100) %\nswitch costume to (fps v)\ncreate clone of (_myself_ v)\nset size to (40) %\nswitch costume to (letter (1) of (FPS))\ngo to x: (212) y: (172)\ncreate clone of (_myself_ v)\nif <(length of (FPS)) = [2]> then\n    switch costume to (letter (2) of (FPS))\n    go to x: (218) y: (172)\n    create clone of (_myself_ v)\nend\n\n@Explains\n\nwhen I receive [gameon v]\nhide\nset [private costume v] to [0]\nforever\n    explainLoad\nend\n\nwhen I start as a clone\ngo to x: ((((private spot) mod (tileWidth)) * (16)) - (cameraX)) y: (((<([ceiling v] of ((private spot) / (tileWidth)) ) = [0]> + ([ceiling v] of ((private spot) / (tileWidth)) )) * (16)) - (cameraY))\nswitch costume to (private costume)\nshow\nwait (0.1) seconds\nreplace item (private spot) of [explains v] with [0]\nrepeat (5)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\ndefine explainLoad\nif <(length of [spawnexplains v]) > [0]> then\n    set [private spot v] to (item (1) of [spawnexplains v])\n    set [private costume v] to (item (2) of [spawnexplains v])\n    replace item (private spot) of [explains v] with (private costume)\n    create clone of (_myself_ v)\n    delete (1) of [spawnexplains v]\n    delete (1) of [spawnexplains v]\n    if <(length of [spawnexplains v]) > [20]> then\n        delete all of [spawnexplains v]\n    end\nend\n\n
ᴀ ᴘʟᴀᴛꜰᴏʀᴍᴇʀ .\n\nWASD / Arrow Keys to move, r to restart .\n\nＩｔ'ｓ ｐｌａｙｉｎｇ ｗｉｔｈ ｓｗｉｔｃｈｉｎｇ ｇｒａｖｉｔｙ ｏｆ ｏｂｊｅｃｔｓ .