cloud city, a platformer !

Instructions: Arrow keys to move.\nPress S to open shop.\n5 levels.\ncollect all coins to open portal. \n love and fav!\nThis is my best platformer so far!\n\nTAGS\n#Alolex1#platformer#bestplatformer#cloudcity#bestgames#nongeneric

@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [, ] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\n\nwhen I receive [play game v]\nforever\n    if <<(current [hour v]) < [19]> and <(current [hour v]) > [7]>> then\n        switch backdrop to (jour v)\n    else\n        switch backdrop to (nuit v)\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\nforever\n    if <(LEVEL:) = [5]> then\n        stop all sounds\n        clear sound effects\n        set language to (en v)::tts\n        set voice to (tenor v)::tts\n        wait (.2) seconds\n        speak [Final, level]::tts\n        wait (0.1) seconds\n        forever\n            play sound [07 v] until done\n            stop [this script v]\n        end\n    end\nend\n\nwhen flag clicked\nrepeat until <(LEVEL:) = [5]>\n    play sound [1-01 Chamber of the Goddess \[A Link to the Past\] v] until done\nend\n\nforever\nend\n\n@Blank\n\nset [a v] to [0]\n\n@player\n\nwhen I start as a clone\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (12)\nset size to (50) %\nrepeat (20)\n    change size by (-0.7)\n    change [ghost v] effect by (4)\n    go to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\nend\ndelete this clone\n\ndefine Game - Win\nrepeat (50)\n    point towards (portal v)\n    turn right (65) degrees\n    move ((distance to [portal v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level: v] by (1)\nwait (1) seconds\n\nwhen flag clicked\nbroadcast (Green flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level: v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\nbroadcast (Tick v) and wait\n\ndefine game on\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nclear graphic effects\nif <key (left arrow v) pressed?> then\n    if <(sprint) = [yes]> then\n        change [sx v] by (-5)\n        switch costume to (gauche v)\n    else\n        change [sx v] by (-3)\n        switch costume to (gauche v)\n    end\nelse\n    switch costume to (normal v)\nend\nif <key (right arrow v) pressed?> then\n    if <(sprint) = [yes]> then\n        change [sx v] by (5)\n        switch costume to (droite v)\n    else\n        change [sx v] by (3)\n        switch costume to (droite v)\n    end\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x By (round (sx))\nend\nif <key (up arrow v) pressed?> then\n    if <(in air) < [4]> then\n        if <(jump boost) = [yes]> then\n            switch costume to (haut normal v)\n            set [sy v] to [20]\n        else\n            switch costume to (haut normal v)\n            set [sy v] to [16]\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        switch costume to (droite haut v)\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to (gauche haut v)\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange player y by (sy)\nTest Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nposition\nif <(y) < [-180]> then\n    set [exit v] to [Die]\nend\n\ndefine Change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    position\n    set [sy v] to [0]\nend\n\ndefine position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x By (sx)\nchange [x v] by (sx)\nposition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-5)\n    if <key (up arrow v) pressed?> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        position\n    end\nend\n\nwhen I receive [play game v]\nclear graphic effects\nforever\n    create clone of (_myself_ v)\nend\n\ndefine Game - Die\nset [exit v] to []\nrepeat (5)\n    set [brightness v] effect to (50)\n    wait (0.1) seconds\n    set [brightness v] effect to (-50)\n    wait (0.1) seconds\nend\nset [brightness v] effect to (50)\nwait (0.5) seconds\n\ndefine Test Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\nwhen I receive [thumbnail v]\nhide\n\nwhen flag clicked\nset [sprint v] to [no]\nset [jump boost v] to [no]\n\nhide\n\n@platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\ngo to [front v] layer\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL:) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\nelse\n    if <(LEVEL:) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [200]\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [0]\n    else\n        if <(LEVEL:) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at X: [360] Y: [0]\n            Clone at X: [0] Y: [250]\n            Clone at X: [1000] Y: [0]\n        else\n            if <(LEVEL:) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at X: [500] Y: [-80]\n                Clone at X: [500] Y: [20]\n                Clone at X: [500] Y: [20]\n                Clone at X: [500] Y: [20]\n            else\n                if <(LEVEL:) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at X: [360] Y: [0]\n                    Clone at X: [0] Y: [90]\n                    Clone at X: [0] Y: [180]\n                    Clone at X: [0] Y: [200]\n                    Clone at X: [800] Y: [60]\n                else\n                    if <(LEVEL:) = [6]> then\n                        switch costume to (level 6 1 v)\n                    else\n                        if <(LEVEL:) = [7]> then\n                            switch costume to (level 6 2 v)\n                            Clone at X: [200] Y: [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone at X: [360] Y: [0]\nClone at X: [0] Y: [250]\nClone at X: [1000] Y: [0]\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\ngo [forward v] (1) layers\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL:) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\nelse\n    if <(LEVEL:) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at X: [730] Y: [0]\n        Clone at X: [400] Y: [0]\n        Clone at X: [360] Y: [200]\n        Clone at X: [360] Y: [0]\n        Clone at X: [250] Y: [100]\n    else\n        if <(LEVEL:) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at X: [360] Y: [0]\n            Clone at X: [0] Y: [250]\n            Clone at X: [-100] Y: [250]\n            Clone at X: [-100] Y: [300]\n            Clone at X: [-100] Y: [450]\n        else\n            if <(LEVEL:) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at X: [500] Y: [-80]\n                Clone at X: [300] Y: [20]\n                Clone at X: [700] Y: [20]\n                Clone at X: [700] Y: [20]\n            else\n                if <(LEVEL:) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at X: [360] Y: [0]\n                    Clone at X: [0] Y: [90]\n                    Clone at X: [0] Y: [180]\n                    Clone at X: [0] Y: [200]\n                    Clone at X: [640] Y: [130]\n                else\n                    switch costume to (level 6 1 v)\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [x v] by (y)\nnext costume\n\n@coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    if <(COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL:) = [1]> then\n    switch costume to (coin v)\n    Clone at X: [50] Y: [0]\n    Clone at X: [1319] Y: [224]\n    Clone at X: [1354] Y: [224]\n    Clone at X: [1387] Y: [224]\nelse\n    if <(LEVEL:) = [2]> then\n        switch costume to (coin v)\n        Clone at X: [47] Y: [-55]\n        Clone at X: [350] Y: [-30]\n        Clone at X: [370] Y: [-30]\n        Clone at X: [390] Y: [-30]\n        Clone at X: [1853] Y: [319]\n    else\n        if <(LEVEL:) = [3]> then\n            switch costume to (coin v)\n            Clone at X: [-64] Y: [28]\n            Clone at X: [166] Y: [65]\n            Clone at X: [285] Y: [386]\n            Clone at X: [1092] Y: [346]\n            Clone at X: [1560] Y: [373]\n            Clone at X: [1328] Y: [572]\n        else\n            if <(LEVEL:) = [4]> then\n                switch costume to (coin v)\n                Clone at X: [78] Y: [-86]\n                Clone at X: [273] Y: [-47]\n                Clone at X: [807] Y: [86]\n                Clone at X: [949] Y: [54]\n                Clone at X: [1922] Y: [72]\n            else\n                if <(LEVEL:) = [5]> then\n                    switch costume to (coin v)\n                    Clone at X: [187] Y: [-41]\n                    Clone at X: [275] Y: [-32]\n                    Clone at X: [282] Y: [227]\n                    Clone at X: [-83] Y: [113]\n                    Clone at X: [275] Y: [518]\n                    Clone at X: [279] Y: [600]\n                    Clone at X: [832] Y: [777]\n                    Clone at X: [1198] Y: [692]\n                    Clone at X: [1356] Y: [592]\n                else\n                    if <(LEVEL:) = [6]> then\n                        switch costume to (coin v)\n                        Clone at X: [-65] Y: [-29]\n                    end\n                end\n            end\n        end\n    end\nend\nset [x v] to [-999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    go to [front v] layer\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\n@portal\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL:) = [1]> then\n    switch costume to (closed v)\n    Clone at X: [1880] Y: [121]\nelse\n    if <(LEVEL:) = [2]> then\n        switch costume to (closed v)\n        Clone at X: [2270] Y: [414]\n    else\n        if <(LEVEL:) = [3]> then\n            switch costume to (closed v)\n            Clone at X: [878] Y: [548]\n        else\n            if <(LEVEL:) = [4]> then\n                switch costume to (closed v)\n                Clone at X: [2300] Y: [51]\n            else\n                if <(LEVEL:) = [5]> then\n                    switch costume to (closed v)\n                    Clone at X: [1469] Y: [650]\n                else\n                    if <(LEVEL:) = [6]> then\n                        switch costume to (closed v)\n                        Clone at X: [10] Y: [168]\n                    else\n                        set [x v] to [-99999]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\n@jump boost\n\nwhen I receive [play game v]\nhide\nswitch costume to (costume1 v)\ngo to (sprite3 v)\ngo to [front v] layer\nforever\n    go to (sprite3 v)\nend\n\nwhen I receive [play game v]\nforever\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [play game v]\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(LEVEL:) > [3]> then\n            set [jump boost v] to [yes]\n            switch costume to (costume3 v)\n        else\n            switch costume to (costume2 v)\n        end\n    end\nend\n\nwhen I receive [play game v]\nforever\n    go [forward v] (2) layers\nend\n\n@Thumbnail\n\nwhen flag clicked\nbroadcast (Thumbnail v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nset size to (100) %\n\n@ghost city\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\nchange [ghost v] effect by (-10)\nset size to (100) %\n\nwhen I receive [thumbnail v]\ngo to [back v] layer\n\nwhen I receive [play game v]\nshow\n\n@background\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL:) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\nelse\n    if <(LEVEL:) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [200]\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [0]\n        Clone at X: [360] Y: [0]\n    else\n        if <(LEVEL:) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at X: [360] Y: [0]\n            Clone at X: [0] Y: [250]\n            Clone at X: [-100] Y: [250]\n            Clone at X: [-100] Y: [300]\n            Clone at X: [50] Y: [410]\n        else\n            if <(LEVEL:) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at X: [500] Y: [-80]\n                Clone at X: [0] Y: [250]\n                Clone at X: [1000] Y: [0]\n            else\n                if <(LEVEL:) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at X: [360] Y: [0]\n                    Clone at X: [0] Y: [90]\n                    Clone at X: [0] Y: [180]\n                    Clone at X: [0] Y: [200]\n                    Clone at X: [800] Y: [60]\n                else\n                    if <(LEVEL:) = [6]> then\n                        switch costume to (level 6 1 v)\n                    else\n                        if <(LEVEL:) = [7]> then\n                            switch costume to (level 6 2 v)\n                            Clone at X: [200] Y: [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@shop\n\nwhen I receive [play game v]\nforever\n    go to [front v] layer\nend\n\n@sprint\n\nwhen I receive [play game v]\nforever\n    go [forward v] (2) layers\nend\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\ngo to (sprite3 v)\ngo to [front v] layer\nforever\n    go to (sprite3 v)\nend\n\nwhen flag clicked\nforever\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(LEVEL:) > [2]> then\n            switch costume to (costume3 v)\n            set [sprint v] to [yes]\n        else\n            switch costume to (costume2 v)\n        end\n    end\nend\n\n@Sprite3\n\nwhen I receive [play game v]\nhide\nset [shop v] to [no]\ngo to x: (0) y: (-300)\nset size to (100) %\nforever\n    down\n    up\nend\n\ndefine down\nif <key (s v) pressed?> then\n    if <(shop) = [yes]> then\n        show\n        set [shop v] to [no]\n        glide (0.6) secs to x: (0) y: (-300)\n        hide\n    else\n        hide\n    end\nend\n\ndefine up\nif <key (s v) pressed?> then\n    if <(shop) = [no]> then\n        show\n        set [shop v] to [yes]\n        glide (0.6) secs to x: (0) y: (0)\n    else\n        hide\n    end\nend\n\nwhen I receive [play game v]\nforever\n    if <key (s v) pressed?> then\nend\n\n@mountains\n\nwhen I receive [green flag v]\nswitch costume to (costume3 v)\n\n