6 Lands - A Scrolling Platformer v1.0
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nbroadcast (MAIN MENU v)\nset volume to (80) %\nwait (5.30) seconds\nforever\n    play sound [bensound-endlessmotion v] until done\nend\n\nwhen I receive [tick v]\nset volume to (80) %\nif <([dead? v] of [player v]) = [1]> then\n    set volume to (45) %\nend\n\n@Blank\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen [space v] key pressed\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n@Menu\n\nwhen I receive [main menu v]\nSet Buttons\nforever\n    broadcast (MENU TICK v) and wait\nend\n\ndefine Create Button | X: (x) Y: (y) Type: (type)\nset [clone? v] to [1]\nset [x v] to (x)\nset [y v] to (y)\nset [button type v] to (type)\ncreate clone of (_myself_ v)\nset [clone? v] to [0]\n\nwhen I receive [menu tick v]\nif <(clone?) = [1]> then\n    go to x: (((x) * (60)) - (150)) y: (y)\n    switch costume to (button type)\n    show\n    clear graphic effects\n    set size to (101) %\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (20)\n        change y by (3)\n        if <mouse down?> then\n            set [game level v] to ((x) + (1))\n            start sound [pop v]\n            broadcast (START GAME v)\n        end\n    end\nelse\n    go to x: (0) y: (0)\n    switch costume to (7 v)\n    set size to (101) %\n    show\nend\n\ndefine Set Buttons\nset [x v] to [0]\nrepeat (6)\n    Create Button | X: (x) Y: [50] Type: ((x) + (1))\n    change [x v] by (1)\nend\n\nwhen I receive [start game v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Editor\n\nwhen I receive [pre animate v]\nif <(GAME MODE) = [2]> then\n    change [i v] by (1)\n    set [editor x v] to (([floor v] of (((round ((mouse x) + (SCROLL X))) / (TILE SIZE)) + (0.6)) ) + (5))\n    set [editor y v] to (([floor v] of (((round ((mouse y) + (SCROLL Y))) / (TILE SIZE)) + (0.4)) ) + (4))\n    set [selected block in level v] to ((((editor x) * (MAP HEIGHT)) + (editor y)) + (1))\n    if <<(i) > [4]> and <not <touching (mouse-pointer v)?>>> then\n        if <<<mouse down?> and <(mouse x) < [195]>> and <not <<(SELECTED TILE) = [3]> and <(SELECTED BLOCK IN LEVEL) = [204]>>>> then\n            delete (item # of (SELECTED BLOCK IN LEVEL) in [collected coins v]) of [collected coins v]\n            if <not <(item (SELECTED BLOCK IN LEVEL) of [~current 𝗠𝗔𝗣~ v]) = (SELECTED TILE)>> then\n                start sound (pick random (1) to (4))\n                replace item (SELECTED BLOCK IN LEVEL) of [~current 𝗠𝗔𝗣~ v] with (SELECTED TILE)\n                Fix level replacement tiles\n            end\n        end\n    end\nend\n\nwhen this sprite clicked\nset [i v] to [0]\nstart sound [Pop v]\nif <(GAME MODE) = [1]> then\n    set [game mode v] to [2]\nelse\n    set [game mode v] to [1]\n    broadcast (RESTART PLAYER v) and wait\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [tick v]\nif <(username) = [groovy-girl]> then\n    show\n    go to x: (-190) y: (147)\n    go to [front v] layer\n    go [backward v] (3) layers\n    if <(GAME MODE) = [2]> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nelse\n    hide\nend\n\ndefine Reset Current Level\nset [item sorter v] to [0]\ndelete all of [~current 𝗠𝗔𝗣~ v]\nif <(GAME LEVEL) = [1]> then\n    repeat (length of [~𝗠𝗔𝗣 1~ v])\n        change [item sorter v] by (1)\n        add (item (item sorter) of [~𝗠𝗔𝗣 1~ v]) to [~current 𝗠𝗔𝗣~ v]\n    end\nelse\n    if <(GAME LEVEL) = [2]> then\n        repeat (length of [~𝗠𝗔𝗣 2~ v])\n            change [item sorter v] by (1)\n            add (item (item sorter) of [~𝗠𝗔𝗣 2~ v]) to [~current 𝗠𝗔𝗣~ v]\n        end\n    else\n        if <(GAME LEVEL) = [3]> then\n            repeat (length of [~𝗠𝗔𝗣 3~ v])\n                change [item sorter v] by (1)\n                add (item (item sorter) of [~𝗠𝗔𝗣 3~ v]) to [~current 𝗠𝗔𝗣~ v]\n            end\n        else\n            if <(GAME LEVEL) = [4]> then\n                repeat (length of [~𝗠𝗔𝗣 4~ v])\n                    change [item sorter v] by (1)\n                    add (item (item sorter) of [~𝗠𝗔𝗣 4~ v]) to [~current 𝗠𝗔𝗣~ v]\n                end\n            else\n                if <(GAME LEVEL) = [5]> then\n                    repeat (length of [~𝗠𝗔𝗣 5~ v])\n                        change [item sorter v] by (1)\n                        add (item (item sorter) of [~𝗠𝗔𝗣 5~ v]) to [~current 𝗠𝗔𝗣~ v]\n                    end\n                else\n                    if <(GAME LEVEL) = [6]> then\n                        repeat (length of [~𝗠𝗔𝗣 6~ v])\n                            change [item sorter v] by (1)\n                            add (item (item sorter) of [~𝗠𝗔𝗣 6~ v]) to [~current 𝗠𝗔𝗣~ v]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nReset Current Level\n\ndefine Fix level replacement tiles\nif <(GAME LEVEL) = [1]> then\n    replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 1~ v] with (SELECTED TILE)\nelse\n    if <(GAME LEVEL) = [2]> then\n        replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 2~ v] with (SELECTED TILE)\n    else\n        if <(GAME LEVEL) = [3]> then\n            replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 3~ v] with (SELECTED TILE)\n        else\n            if <(GAME LEVEL) = [4]> then\n                replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 4~ v] with (SELECTED TILE)\n            else\n                if <(GAME LEVEL) = [5]> then\n                    replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 5~ v] with (SELECTED TILE)\n                else\n                    if <(GAME LEVEL) = [6]> then\n                        replace item (SELECTED BLOCK IN LEVEL) of [~𝗠𝗔𝗣 6~ v] with (SELECTED TILE)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\nif <(GAME LEVEL) < [6]> then\n    change [game level v] by (1)\n    Reset Current Level\n    broadcast (RESTART PLAYER v) and wait\n    broadcast (remove screen effect v)\nend\n\n@Player\n\nwhen flag clicked\nhide\n\ndefine Get Tile | x: (x) y: (y)\nset [tile # v] to (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1)))\nset [tile type v] to (item (tile #) of [~current 𝗠𝗔𝗣~ v])\nif <((round ((y) / (TILE SIZE))) + (1)) > [0]> then\n    if <<(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Individual]>> then\n        set [touching level v] to [true]\n    end\n    if <<<(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad]> or <(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]>> and <(hitbox level) = [1]>> then\n        set [dead? v] to [1]\n    end\nend\n\ndefine Discover if Touching Level\nset [touching level v] to [false]\nset [dead? v] to [0]\nset [hitbox level v] to [1]\nGet Tile | x: ((x) - ((player width) / (8))) y: (y)\nGet Tile | x: ((x) + ((player width) / (8))) y: (y)\nset [hitbox level v] to [2]\nGet Tile | x: ((x) - ((player width) / (2))) y: ((y) - ((player height) / (2)))\nGet Tile | x: ((x) + ((player width) / (2))) y: ((y) - ((player height) / (2)))\nset [hitbox level v] to [3]\nGet Tile | x: ((x) - ((player width) / (2))) y: (((y) + ((player height) / (2))) - (14))\nGet Tile | x: ((x) + ((player width) / (2))) y: (((y) + ((player height) / (2))) - (14))\n\ndefine Position\ngo to x: (((x) - (SCROLL X)) - (240)) y: (((y) - (SCROLL Y)) - (180))\n\ndefine Rise\nyv\nchange [y v] by (yv)\nchange [in air v] by (1)\nDiscover if Touching Level\nrepeat until <not <(touching level) = [true]>>\n    if <(yv) > [0]> then\n        change [y v] by ((-1) * (yv))\n    else\n        change [y v] by (1)\n        if <(in air) > [5]> then\n            start sound [Land v]\n        end\n        set [in air v] to [0]\n    end\n    set [yv v] to [0]\n    Discover if Touching Level\nend\n\ndefine Change X by: (x)\nchange [x v] by (x)\nDiscover if Touching Level\nif <(touching level) = [true]> then\n    change [x v] by ((-1) * (x))\n    if <<<<(yv) > [2]> and <(in air) > [7]>> and <([abs v] of (xv) ) > [1]>> and <[game rules v] contains [Wall Cling]?>> then\n        if <(controls on?) > [-1]> then\n            delete all of [player movements v]\n        end\n        set [wall cling - previous xv v] to (xv)\n        set [controls on? v] to [-1]\n    else\n        set [xv v] to [0]\n    end\n    Discover if Touching Level\nend\n\ndefine Controls | Speed (x speed) Jump Height (height) <left> <right>\nif <left> then\n    add [Left] to [player movements v]\nend\nif <right> then\n    add [Right] to [player movements v]\nend\nif <(controls on?) = [1]> then\n    if <right> then\n        change [xv v] by (x speed)\n    end\n    if <left> then\n        change [xv v] by ((-1) * (x speed))\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(in air) < [3]>> then\n        change [yv v] by (height)\n        add [Up] to [player movements v]\n    end\nelse\n    if <(controls on?) = [-1]> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            if <(wall cling - previous xv) > [0]> then\n                set [xv v] to [-18]\n            else\n                set [xv v] to [18]\n            end\n            set [yv v] to [16]\n            set [controls on? v] to [0]\n        end\n    end\nend\n\ndefine Reset Scrolling\nchange [scroll x v] by (round ((((x) - (240)) - (SCROLL X)) / (6)))\nchange [scroll y v] by (round ((((y) - (180)) - (SCROLL Y)) / (6)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nif <(SCROLL Y) > [4592]> then\n    set [scroll y v] to [4592]\nend\nif <(SCROLL X) > [14488]> then\n    set [scroll x v] to [14488]\nend\nif <(x) < (((player width) / (2)) + (3))> then\n    set [x v] to (((player width) / (2)) + (3))\n    set [xv v] to [0]\nend\n\ndefine Set Correct Costume\nchange [animation frame v] by ((1) / (3))\nif <(animation frame) > [4.75]> then\n    set [animation frame v] to [1]\nend\nif <([abs v] of (xv) ) > [1]> then\n    set [costume # v] to ([floor v] of (animation frame) )\nelse\n    set [costume # v] to [1]\nend\nif <(in air) > [4]> then\n    if <(yv) > [0]> then\n        set [costume # v] to [5]\n    else\n        set [costume # v] to [6]\n    end\nend\nif <(controls on?) = [-1]> then\n    set [costume # v] to [7]\nend\n\ndefine Get Coordinates (item number)\nset [targeted x v] to (round ((item number) / (MAP HEIGHT)))\nset [targeted y v] to ((item number) - ((MAP HEIGHT) * (round ((item number) / (MAP HEIGHT)))))\n\ndefine Begin\nset [x v] to (item (1) of [checkpoint v])\nset [y v] to (item (2) of [checkpoint v])\nset [yv v] to [0]\nset [xv v] to [0]\nset [player width v] to [20]\nset [player height v] to [42]\nset [in air v] to [0]\nPosition\ngo to [front v] layer\nset rotation style [left-right v]\npoint in direction (90)\ndelete all of [game rules v]\ndelete all of [entity tiles v]\nset [dead? v] to [0]\nset [player tile v] to (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1)))\nset [effect v] to [100]\nset [end? v] to [0]\nhide\n\ndefine die\nbroadcast (TICK v)\nstart sound [Lose v]\nset [yv v] to [10]\nset [xv v] to ((xv) * (1.3))\nif <(xv) < [0]> then\n    set [costume # v] to [9]\nelse\n    set [costume # v] to [8]\nend\nset rotation style [all around v]\nrepeat until <(y position) < [-190]>\n    change x by (xv)\n    turn right (xv) degrees\n    set [xv v] to ((xv) * (0.9))\n    change y by (yv)\n    change [yv v] by (-1)\nend\nhide\nwait (1) seconds\nBegin\n\nwhen I receive [start game v]\nset [controls on? v] to [1]\nset [i v] to [0]\nset [game mode v] to [1]\ndelete all of [checkpoint v]\nadd [90] to [checkpoint v]\nadd [186] to [checkpoint v]\nBegin\nset [scroll x v] to ((x) - (240))\nset [scroll y v] to ((y) - (180))\n\nwhen I receive [restart player v]\nset [end? v] to [0]\ndelete all of [checkpoint v]\nadd [90] to [checkpoint v]\nadd [186] to [checkpoint v]\ndelete all of [collected coins v]\nBegin\n\nwhen I receive [tick v]\ngo to [front v] layer\nif <(GAME MODE) = [1]> then\n    if <(end?) = [0]> then\n        change [effect v] by (-5)\n        if <(effect) < [0]> then\n            set [effect v] to [0]\n        end\n    else\n        change [effect v] by (5)\n        go to [front v] layer\n        go [backward v] (5) layers\n        if <(effect) > [100]> then\n            set [effect v] to [100]\n            wait (1) seconds\n            broadcast (NEXT LEVEL v)\n            stop [this script v]\n        end\n    end\n    set [ghost v] effect to (effect)\n    set [brightness v] effect to (effect)\n    if <not <(costume [number v]) = (costume #)>> then\n        switch costume to (costume #)\n    end\n    if <(xv) > [0]> then\n        point in direction (90)\n    else\n        if <(xv) < [0]> then\n            point in direction (-90)\n        end\n    end\n    set [ghost v] effect to (effect)\n    if <not <(costume [number v]) = (costume #)>> then\n        switch costume to (costume #)\n    end\n    if <(xv) > [0]> then\n        point in direction (90)\n    else\n        if <(xv) < [0]> then\n            point in direction (-90)\n        end\n    end\nelse\n    switch costume to (stand v)\n    clear graphic effects\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n    end\nend\nshow\nPosition\n\nwhen I receive [pre animate v]\ndelete all of [player movements v]\nif <(end?) = [0]> then\n    if <(GAME MODE) = [1]> then\n        if <<<(((x) - (SCROLL X)) - (240)) > [-240]> and <(((x) - (SCROLL X)) - (240)) < [240]>> and <<(((y) - (SCROLL Y)) - (180)) > [-180]> and <(((y) - (SCROLL Y)) - (180)) < [180]>>> then\n            Controls | Speed [2.8] Jump Height [5.5] <<key (left arrow v) pressed?> or <key (a v) pressed?>> <<key (right arrow v) pressed?> or <key (d v) pressed?>>\n        end\n        if <(controls on?) = [0]> then\n            change [i v] by (1)\n            if <(i) > [13]> then\n                set [controls on? v] to [1]\n                set [i v] to [0]\n            end\n            Change X by: ((xv) * (0.8))\n            set [xv v] to ((xv) * (0.97))\n        else\n            Change X by: (xv)\n            set [xv v] to ((xv) * (0.7))\n        end\n        Rise\n        Reset Scrolling\n        if <(y) < [-30]> then\n            set [dead? v] to [1]\n        end\n        if <[entity tiles v] contains (PLAYER TILE)?> then\n            set [dead? v] to [1]\n        end\n    else\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            change [y v] by (8)\n        end\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            change [y v] by (-8)\n        end\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [x v] by (8)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [x v] by (-8)\n        end\n        Reset Scrolling\n    end\nend\nset [player tile v] to (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1)))\nif <(dead?) = [1]> then\n    die\nend\nSet Correct Costume\n\ndefine yv\nif <(controls on?) > [-1]> then\n    change [yv v] by (-1)\n    if <(yv) < [-15]> then\n        set [yv v] to [-15]\n    end\nelse\n    change [yv v] by (-1)\n    if <(yv) < [-3]> then\n        set [yv v] to [-3]\n    end\n    if <<(in air) = [0]> or <<<[player movements v] contains [Right]?> and <(wall cling - previous xv) < [0]>> or <<[player movements v] contains [Left]?> and <(wall cling - previous xv) > [0]>>>> then\n        set [controls on? v] to [1]\n        set [xv v] to [0]\n    end\nend\n\nwhen I receive [start game v]\ndelete all of [collected coins v]\n\nwhen I receive [end level v]\nif <(end?) = [0]> then\n    start sound [Win v]\n    set [end? v] to [1]\nend\n\nwhen I receive [remove screen effect v]\nset [scroll x v] to ((x) - (240))\nset [scroll y v] to ((y) - (180))\n\nwait (1) seconds\n\nwhen I receive [player bounce v]\nset [yv v] to [19]\n\n@Tile Set\n\ndefine Create Grid | Length: (length) Height: (height)\ndelete all of [collected coins v]\nset [grid height v] to (height)\nset [grid length v] to (length)\nset [y v] to [0]\nset [x v] to [0]\nset [liquid y v] to [0]\nshow\nrepeat (height)\n    repeat (length)\n        create clone of (_myself_ v)\n        change [x v] by (1)\n    end\n    set [x v] to [0]\n    change [y v] by (1)\nend\nhide\n\ndefine Position\nif <(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]> then\n    go to x: ((((x) * (TILE SIZE)) - (SCROLL X)) - (240)) y: (((((y) * (TILE SIZE)) - (SCROLL Y)) - (180)) + (liquid y))\nelse\n    go to x: ((((x) * (TILE SIZE)) - (SCROLL X)) - (240)) y: ((((y) * (TILE SIZE)) - (SCROLL Y)) - (180))\nend\nif <(y dir) = [1]> then\n    change [liquid y v] by ((1) / (5))\n    if <(liquid y) > [2]> then\n        set [y dir v] to [0]\n    end\nelse\n    change [liquid y v] by ((-1) / (5))\n    if <(liquid y) < [-2]> then\n        set [y dir v] to [1]\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine Reset Map | Fill Block: (block type)\nif <not <(block type) = []>> then\n    delete all of [~𝗠𝗔𝗣 1~ v]\n    repeat (MAP HEIGHT)\n        repeat (MAP WIDTH)\n            add (block type) to [~𝗠𝗔𝗣 1~ v]\n        end\n    end\nend\n\ndefine Handle Tile Replacements | Extra Room: (extra)\nrepeat until <not <((((x) * (TILE SIZE)) - (SCROLL X)) - (240)) < [-240]>>\n    change [x v] by (grid length)\nend\nrepeat until <not <((((x) * (TILE SIZE)) - (SCROLL X)) - (240)) > ((256) + (extra))>>\n    change [x v] by ((-1) * (grid length))\nend\nrepeat until <not <((((y) * (TILE SIZE)) - (SCROLL Y)) - (180)) < [-180]>>\n    change [y v] by (grid height)\nend\nrepeat until <not <((((y) * (TILE SIZE)) - (SCROLL Y)) - (180)) > ((196) + (extra))>>\n    change [y v] by ((-1) * (grid height))\nend\n\nwhen I receive [tick v]\nPosition\nclear graphic effects\nset size to (((TILE SIZE) * (3.333)) + (1)) %\nSet Correct Costume\nif <not <(costume?) = (costume [name v])>> then\n    switch costume to (costume?)\nend\nif <(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]> then\n    go to [back v] layer\n    if <(item (item ((my item) + (1)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]> then\n        next costume\n    end\nend\nif <<(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [15]> and <<(distance to [player v]) < [35]> and <([yv v] of [player v]) < [-1]>>> then\n    broadcast (player bounce v)\n    next costume\nend\nif <<(SELECTED BLOCK IN LEVEL) = (my item)> and <(GAME MODE) = [2]>> then\n    set [brightness v] effect to (20)\nend\nif <(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Collectable]> then\n    set size to ((((TILE SIZE) * (3.33)) + (1)) / (1.3)) %\n    if <[collected coins v] contains (my item)?> then\n        hide\n    else\n        show\n        if <<(distance to [player v]) < [35]> and <(GAME MODE) = [1]>> then\n            start sound [Coin v]\n            add (my item) to [collected coins v]\n        end\n    end\nelse\n    show\nend\nif <<(GAME MODE) = [1]> and <(distance to [player v]) < [40]>> then\n    if <<(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [13]> and <not <<(item (1) of [checkpoint v]) = ((x) * (TILE SIZE))> and <(item (2) of [checkpoint v]) = ((y) * (TILE SIZE))>>>> then\n        start sound [Low Whoosh v]\n        delete all of [checkpoint v]\n        add ((x) * (TILE SIZE)) to [checkpoint v]\n        add ((y) * (TILE SIZE)) to [checkpoint v]\n    end\n    if <<(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [14]> and <([end? v] of [player v]) = [0]>> then\n        broadcast (end level v)\n    end\nend\nif <(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [17]> then\n    turn right (13) degrees\nelse\n    point in direction (90)\nend\n\ndefine Find Block Surroundings Code\nset [block costume code v] to []\nif <<(item (item ((my item) + (1)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item ((my item) + (1)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]>> then\n    set [block costume code v] to (join (block costume code) [5])\nelse\n    set [block costume code v] to (join (block costume code) [0])\nend\nif <<(item (item ((my item) + (MAP HEIGHT)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item ((my item) + (MAP HEIGHT)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]>> then\n    set [block costume code v] to (join (block costume code) [5])\nelse\n    set [block costume code v] to (join (block costume code) [0])\nend\nif <<(item (item ((my item) - (1)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item ((my item) - (1)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]>> then\n    set [block costume code v] to (join (block costume code) [5])\nelse\n    set [block costume code v] to (join (block costume code) [0])\nend\nif <<(item (item ((my item) - (MAP HEIGHT)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item ((my item) - (MAP HEIGHT)) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad Liquid]>> then\n    set [block costume code v] to (join (block costume code) [5])\nelse\n    set [block costume code v] to (join (block costume code) [0])\nend\n\ndefine Set My Item\nset [my item v] to (((x) * (MAP HEIGHT)) + ((y) + (1)))\n\ndefine Set Correct Costume\nchange [tile animation v] by ((1) / (2))\nif <(tile animation) > [8]> then\n    set [tile animation v] to [1]\nend\nset [costume? v] to (item (my item) of [~current 𝗠𝗔𝗣~ v])\nif <(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> then\n    Find Block Surroundings Code\n    set [costume? v] to (item (my item) of [~current 𝗠𝗔𝗣~ v])\n    switch costume to (costume?)\n    set [costume? v] to ((costume [number v]) + ((item # of (block costume code) in [block costume codes v]) - (1)))\nelse\n    if <<(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Collectable]> and <(GAME MODE) = [1]>> then\n        set [costume? v] to ([floor v] of ((tile animation) + (34)) )\n    else\n        if <(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [13]> then\n            if <<(item (1) of [checkpoint v]) = ((x) * (TILE SIZE))> and <(item (2) of [checkpoint v]) = ((y) * (TILE SIZE))>> then\n                set [costume? v] to ([floor v] of ((tile animation) + (51)) )\n            else\n                set [costume? v] to [13]\n            end\n        else\n            if <(item (my item) of [~current 𝗠𝗔𝗣~ v]) = [14]> then\n                set [costume? v] to ([floor v] of ((tile animation) + (59)) )\n            else\n                set [costume? v] to (item (my item) of [~current 𝗠𝗔𝗣~ v])\n            end\n        end\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\n\nwhen I receive [start game v]\nset [tile size v] to [47]\nset [map height v] to [100]\nset [map width v] to [300]\nCreate Grid | Length: [12] Height: [9]\n\nwhen I receive [pre animate v]\nHandle Tile Replacements | Extra Room: [11]\nSet My Item\n\nReset Map | Fill Block: [3]\n\nwhen I start as a clone\nSet My Item\nSet Correct Costume\nshow\nif <not <(costume?) = (costume [name v])>> then\n    switch costume to (costume?)\nend\nif <(item (item (my item) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Collectable]> then\n    set size to ((((TILE SIZE) * (3.33)) + (1)) / (1.3)) %\nend\n\n@Options\n\nwhen I receive [tick v]\nif <(GAME MODE) = [2]> then\n    if <(clone) = [1]> then\n        show\n        if <(item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory v]) = []> then\n            hide\n        end\n        Position\n        switch costume to (3 v)\n        switch costume to (item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory v])\n        say []\n        if <touching (mouse-pointer v)?> then\n            say (item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory labels v])\n        end\n        set [brightness v] effect to (0)\n        go to [front v] layer\n        go [backward v] (5) layers\n        if <(SELECTED TILE) = (item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory v])> then\n            set [brightness v] effect to (20)\n        end\n        set size to (101) %\n    else\n        switch costume to (arrows v)\n        go to x: (214) y: (0)\n        go to [front v] layer\n        show\n        set size to (100) %\n        change [i v] by (1)\n    end\nelse\n    hide\nend\n\ndefine Create menu\nset [y v] to [0]\nset [inventory column v] to [0]\nset [clone v] to [1]\nrepeat (8)\n    create clone of (_myself_ v)\n    change [y v] by (1)\nend\nset [clone v] to [0]\n\ndefine Position\ngo to x: (214) y: (((y) * (-35)) + (130))\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nCreate menu\n\nwhen this sprite clicked\nif <(clone) = [0]> then\n    if <(i) > [8]> then\n        set [i v] to [0]\n        if <(mouse y) > [0]> then\n            if <(INVENTORY COLUMN) > [0]> then\n                change [inventory column v] by (-1)\n                set [selected tile v] to (item ((1) + ((INVENTORY COLUMN) * (8))) of [inventory v])\n            end\n        else\n            if <(INVENTORY COLUMN) < ((round ((length of [inventory v]) / (8))) - (1))> then\n                change [inventory column v] by (1)\n                set [selected tile v] to (item ((1) + ((INVENTORY COLUMN) * (8))) of [inventory v])\n            end\n        end\n    end\nend\n\nwhen this sprite clicked\nif <<(GAME MODE) = [2]> and <(clone) = [1]>> then\n    if <<mouse down?> and <not <(item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory v]) = []>>> then\n        set [selected tile v] to (item (((y) + (1)) + ((INVENTORY COLUMN) * (8))) of [inventory v])\n    end\nend\n\n@Game Loop\n\nwhen I receive [start game v]\nforever\n    broadcast (PRE ANIMATE v) and wait\n    set [entities onscreen v] to [0]\n    delete all of [entity tiles v]\n    delete all of [tiles onscreen v]\n    broadcast (TICK v) and wait\nend\n\n@Levl_Labl\n\nwhen I receive [restart player v]\nset [ghost effect v] to [-220]\n\nwhen I receive [tick v]\nchange [ghost effect v] by (7)\nswitch costume to (GAME LEVEL)\nset [ghost v] effect to ((ghost effect) * (2))\ngo to [front v] layer\ngo [backward v] (3) layers\nset x to (0)\nset y to (ghost effect)\nif <(y position) < [0]> then\n    set y to (0)\nend\nset size to (100) %\nshow\n\nwhen I receive [start game v]\nset [ghost effect v] to [-220]\n\nwhen flag clicked\nhide\n\n@Screen Effect\n\nwhen I receive [end level v]\nset [ghost v] effect to (100)\nset [brightness v] effect to (-100)\nshow\ngo to x: (0) y: (-352)\ngo to [front v] layer\nrepeat (15)\n    go to [front v] layer\n    change y by (24)\n    change [ghost v] effect by (-8)\n    change [brightness v] effect by (7)\nend\n\nwhen I receive [remove screen effect v]\ngo to [front v] layer\nwait (0.2) seconds\nrepeat (20)\n    go to [front v] layer\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [start game v]\nhide\n\nwhen flag clicked\nhide\n\n@World Scanner\n\ndefine Get Coordinates (item number)\nset [targeted x v] to (round ((item number) / (MAP HEIGHT)))\nset [targeted y v] to ((item number) - ((MAP HEIGHT) * (round ((item number) / (MAP HEIGHT)))))\n\ndefine Scan Tiles | Starting X (x)\nrepeat (LOADED CHUNK SIZE)\n    set [scanner x v] to (x)\n    repeat (LOADED CHUNK SIZE)\n        change [scanner x v] by (1)\n        set [my item v] to (((round (scanner x)) * (MAP HEIGHT)) + ((round (scanner y)) + (1)))\n        add (my item) to [loaded tiles v]\n        if <[entities to un-delete later v] contains (my item)?> then\n            add (my item) to [un delete these entities v]\n            delete (item # of (my item) in [entities to un-delete later v]) of [entities to un-delete later v]\n        end\n    end\n    change [scanner y v] by (-1)\nend\n\ndelete all of [loaded tiles v]\nif <(GAME MODE) = [1]> then\n    Get Coordinates (PLAYER TILE)\n    set [scanner y v] to ((targeted y) + ((LOADED CHUNK SIZE) / (2)))\n    set [loaded chunk size v] to [19]\n    Scan Tiles | Starting X ((targeted x) - ((LOADED CHUNK SIZE) / (2)))\nend\n\n@Enemies\n\nwhen flag clicked\nset [x v] to [100]\nset [y v] to [100]\nset [yv v] to [0]\nset [npc width v] to [20]\nset [npc height v] to [42]\nset [clone? v] to [0]\ndelete all of [entities to un-delete later v]\ndelete all of [un delete these entities v]\nswitch costume to (enemy1 v)\nhide\n\ndefine Get Tile | x: (x) y: (y)\nset [tile # v] to ([ceiling v] of (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1))) )\nset [tile type v] to (item (tile #) of [~current 𝗠𝗔𝗣~ v])\nif <((round ((y) / (TILE SIZE))) + (1)) > [0]> then\n    if <<(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Solid]> or <(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Individual]>> then\n        set [touching level v] to [true]\n    end\n    if <<(item (item (tile #) of [~current 𝗠𝗔𝗣~ v]) of [tile types v]) = [Bad]> and <not <(hitbox level) = [1]>>> then\n        set [dead? v] to [1]\n    end\nend\n\ndefine Discover if Touching Level\nset [touching level v] to [false]\nGet Tile | x: ((x) - ((npc width) / (2))) y: ((y) - ((npc height) / (2)))\nGet Tile | x: ((x) + ((npc width) / (2))) y: ((y) - ((npc height) / (2)))\n\ndefine Position\ngo to x: (((x) - (SCROLL X)) - (240)) y: (((y) - (SCROLL Y)) - (180))\n\ndefine Rise\nchange [yv v] by (-1)\nchange [y v] by (yv)\nchange [in air v] by (1)\nset [rise i v] to [0]\nDiscover if Touching Level\nif <(touching level) = [true]> then\n    change [y v] by ((-1) * (yv))\n    if <(yv) < [1]> then\n        set [in air v] to [0]\n    end\n    Discover if Touching Level\n    set [yv v] to [0]\nend\n\ndefine Change X by: (x)\nchange [x v] by (x)\nDiscover if Touching Level\nif <(touching level) = [true]> then\n    set [xv v] to [0]\n    change [x v] by ((-1) * (x))\n    if <(in air) < [2]> then\n        set [yv v] to [9]\n    end\n    Discover if Touching Level\nend\n\ndefine Controls\nGet Coordinates (PLAYER TILE)\nif <<(targeted y) > ((round ((y) / (TILE SIZE))) + (2))> and <([in air v] of [player v]) < [2]>> then\n    if <(in air) < [4]> then\n        change [yv v] by (4.5)\n    end\nend\nif <(targeted x) < ((round ((x) / (TILE SIZE))) - (0))> then\n    change [xv v] by (-1)\n    set [move type v] to [3]\nelse\n    if <(targeted x) > ((round ((x) / (TILE SIZE))) + (0))> then\n        change [xv v] by (1)\n        set [move type v] to [0]\n    else\n        Assign random movements\n    end\nend\n\nif <not <[loaded tiles v] contains (my item)?>> then\n    add (my item) to [entities to un-delete later v]\n    delete this clone\nend\n\nUn Delete Entities\n\nwhen [space v] key pressed\n\nif <(clone?) = [0]> then\n    set [x v] to ([x v] of [player v])\n    set [y v] to ([y v] of [player v])\n    set [my item v] to ([ceiling v] of (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1))) )\n    create clone of (_myself_ v)\nend\n\ndefine Assign random movements\nchange [i v] by (1)\nif <(i) > [40]> then\n    set [i v] to [0]\n    set [move type v] to (pick random (1) to (3))\nend\nif <(move type) = [1]> then\n    change [xv v] by (-1)\nelse\n    if <(move type) = [2]> then\n        change [xv v] by (1)\n    else\n        change [xv v] by (0)\n    end\nend\n\ndefine Get Coordinates (item number)\nset [targeted x v] to (round ((item number) / (MAP HEIGHT)))\nset [targeted y v] to ((item number) - ((MAP HEIGHT) * (round ((item number) / (MAP HEIGHT)))))\n\ndefine Set Correct Costume\nswitch costume to (enemy1 v)\n\nwhen I start as a clone\nset [i v] to [41]\nAssign random movements\nset [clone? v] to [1]\nSet Correct Costume\n\ndefine Un Delete Entities\nrepeat (length of [un delete these entities v])\n    Get Coordinates (item (1) of [un delete these entities v])\n    set [x v] to ((targeted x) * (TILE SIZE))\n    set [y v] to (((targeted y) - (1)) * (TILE SIZE))\n    create clone of (_myself_ v)\n    delete (1) of [un delete these entities v]\nend\n\nchange [animation frame v] by (0.25)\nif <(animation frame) > [4]> then\n    set [animation frame v] to [1]\nend\nif <([abs v] of (xv) ) > [1]> then\n    switch costume to (animation frame)\nend\n\nadd (my item) to [entities to un-delete later v]\n\nset [x v] to ([x v] of [player v])\nset [y v] to ([y v] of [player v])\nset [my item v] to ([ceiling v] of (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1))) )\nadd (my item) to [entities to un-delete later v]\ncreate clone of (_myself_ v)\n\nwhen I receive [pre animate v]\nif <(clone?) = [1]> then\n    set [my item v] to ([ceiling v] of (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1))) )\n    Get Coordinates (PLAYER TILE)\n    Change X by: (xv)\n    set [xv v] to ((xv) * (0.7))\n    Rise\n    set [my item v] to ([ceiling v] of (((round ((x) / (TILE SIZE))) * (MAP HEIGHT)) + ((round ((y) / (TILE SIZE))) + (1))) )\n    add (my item) to [entity tiles v]\n    Controls\nend\n\nwhen I receive [tick v]\nif <(clone?) = [1]> then\n    hide\n    if <(round (xv)) > [0]> then\n        point in direction (90)\n    end\n    if <(round (xv)) < [0]> then\n        point in direction (-90)\n    end\n    go to [front v] layer\n    go [backward v] ((ENTITIES ONSCREEN) + (5)) layers\n    Position\n    Set Correct Costume\n    show\n    change [entities onscreen v] by (1)\nelse\n    hide\nend\n\n@fps\n\nwhen I receive [pre animate v]\nchange [fps count v] by (1)\nif <(timer) > [1]> then\n    set [fps v] to (fps count)\n    set [fps count v] to [0]\n    reset timer\nend\n\n@Characters\n\n@INTRO\n\nwhen flag clicked\nwait (0.6) seconds\nforever\n    point in direction ((([sin v] of ((timer) * (200)) ) * (10)) + (90))\nend\n\nwhen flag clicked\npoint in direction (90)\nshow\ngo to [front v] layer\nclear graphic effects\nswitch costume to (costume1 v)\nwait (0.08) seconds\nswitch costume to (costume6 v)\nwait (0.06) seconds\nswitch costume to (costume7 v)\nwait (0.07) seconds\nswitch costume to (costume2 v)\nwait (0.1) seconds\nswitch costume to (costume3 v)\nwait (0.1) seconds\nswitch costume to (costume4 v)\nrepeat (5)\n    change [brightness v] effect by (25)\nend\nrepeat (5)\n    change [brightness v] effect by (-20)\nend\nswitch costume to (costume5 v)\nwait (3.5) seconds\nbroadcast (MAIN MENU v)\nrepeat (5)\n    change [brightness v] effect by (25)\nend\nhide\n\nwhen flag clicked\nplay sound [lion guard karaoke v] until done\n\n