Impossible Scrolling Platformer

Instructions: EN - I’m French, sorry for spelling mistakes. \n\nPièces = Coins\n- Click the FX button or music button to stop the sounds or music \n- Move with arrow keys\n- Don’t touch the red and don’t fall\n- Collect all coins to open the portal\n- Press SPACE bar to see the coins collected and to be collected\n- Complete the 7 levels\n- Don't get discouraged\n- Enjoy !\n\nLet me know if there are any bugs or anything\n\nFR -\n- Cliques sur le bouton FX ou sur le bouton musique pour arrêter les sons ou la musique\n- Utilises les flèches pour te diriger\n- Ne touches pas le rouge et ne tombe pas\n- Collectes toutes les pièces pour ouvrir le portail\n- Appuies sur ESPACE pour voir les pièces collectées et à collecter\n- Viens au bout des 7 niveaux\n- Les niveaux sont durs mais ne te décourage pas !\n- Profite !\n\nPréviens moi si il y a des bugs ou autres

@Stage\n\n@Joueur\n\nwhen I receive [drapeau vert v]\nhide\ngo to [front v] layer\n\nwhen I receive [jouer v]\nforever\n    broadcast (Réinitialisation v) and wait\n    broadcast (Installer v) and wait\n    Début du jeu ? (Game on )\n    repeat until <(SORTIE) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(SORTIE) = [Fini]> then\n        Jeu-Fini\n    else\n        Jeu-Mort\n    end\nend\n\ndefine Début du jeu ? (Game on )\nset [y v] to [0]\nset [x v] to [0]\nset [sy v] to [0]\nset [en l'air v] to [0]\nset [sortie v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <key (left arrow v) pressed?> then\n    Changer Joueur X par [-8]\nend\nif <key (right arrow v) pressed?> then\n    Changer Joueur X par [8]\nend\nif <key (up arrow v) pressed?> then\n    if <(En l'air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nchange [sy v] by (-2)\nChanger Joueur Y par (sy)\nset [défilement x v] to (X)\nif <(Défilement X) < [0]> then\n    set [défilement x v] to [0]\nend\nchange [défilement y v] by (round (((Y) - (Défilement Y)) / (10)))\nif <(Défilement Y) < [0]> then\n    set [défilement y v] to [0]\nend\nPosition\nif <(Y) < [-300]> then\n    set [sortie v] to [mort]\nend\n\ndefine Changer Joueur Y par (sy)\nchange [y v] by (sy)\nchange [en l'air v] by (1)\nPosition\nTest-Mort\nrepeat until <not <touching (platformes v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [en l'air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((X) - (Défilement X)) y: ((Y) - (Défilement Y))\n\ndefine Changer Joueur X par (sx)\nchange [x v] by (sx)\nPosition\nTest-Mort\nif <touching (platformes v)?> then\n    repeat (10)\n        change [y v] by (1)\n        Position\n        if <not <touching (platformes v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-10)\n    repeat until <not <touching (platformes 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\ndefine Jeu-Mort\nbroadcast (Mort v)\nset [sortie v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test-Mort\nif <touching color (#ff0000)?> then\n    set [sortie v] to [mort]\nend\n\ndefine Jeu-Fini\nrepeat (50)\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [niveau v] by (1)\n\nwhen backdrop switches to [arrière plan1 v]\nset [niveau v] to [1]\nbroadcast (Drapeau Vert v) and wait\nbroadcast (Jouer v) and wait\n\nwhen flag clicked\nhide variable [niveau v]\nhide variable [pièces v]\nhide variable [pièces max v]\nswitch backdrop to (présentation v)\nhide\nforever\n    if <key (space v) pressed?> then\n        switch backdrop to (arrière plan1 v)\n        show variable [niveau v]\n        stop [this script v]\n    end\nend\n\nwhen backdrop switches to [arrière plan1 v]\nwait (2) seconds\nforever\n    if <key (space v) pressed?> then\n        show variable [pièces max v]\n        show variable [pièces v]\n        wait (2) seconds\n        hide variable [pièces v]\n        hide variable [pièces max v]\n    end\nend\n\nwhen I receive [niveau suivant v]\nset [sortie v] to [Fini]\n\nwhen backdrop switches to [arrière plan1 v]\nforever\n    if <(SORTIE) = [mort]> then\n        start sound [Oops v]\n    end\nend\n\n@Platformes\n\nwhen I receive [drapeau vert v]\nhide\n\nwhen I receive [tick v]\nPosition ((X) - (Défilement X)) ((Y) - (Défilement Y))\n\nwhen I receive [installer v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(NIVEAU) = [1]> then\n    switch costume to (niveau 1.1 v)\n    Clone à X : [340] Y : [0]\n    Clone à X : [340] Y : [0]\n    Clone à X : [380] Y : [0]\nelse\n    if <(NIVEAU) = [2]> then\n        switch costume to (niveau 2.1 v)\n        Clone à X : [0] Y : [400]\n        Clone à X : [340] Y : [-300]\n    else\n        if <(NIVEAU) = [3]> then\n            switch costume to (niveau 3.1 v)\n            Clone à X : [480] Y : [0]\n        else\n            if <(NIVEAU) = [4]> then\n                switch costume to (niveau 4.1 v)\n                Clone à X : [480] Y : [50]\n            else\n                if <(NIVEAU) = [5]> then\n                    move (200) steps\n                    switch costume to (niveau 5 barrière v)\n                    Clone à X : [0] Y : [0]\n                    Clone à X : [350] Y : [0]\n                else\n                    if <(NIVEAU) = [6]> then\n                        switch costume to (niveau 6.1 v)\n                        Clone à X : [350] Y : [0]\n                    else\n                        if <(NIVEAU) = [7]> then\n                            switch costume to (niveau 7.1 v)\n                            Clone à X : [200] Y : [-10]\n                            Clone à X : [150] Y : [10]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                        else\n                            switch costume to (niveau fin 1 v)\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [350] Y : [0]\n                            Clone à X : [0] Y : [380]\n                            Clone à X : [350] Y : [80]\n                            Clone à X : [0] Y : [-350]\n                            Clone à X : [350] 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\ndefine Clone à X : (x) Y : (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [réinitialisation v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nif <(costume [name v]) = [niveau 5 barrière]> then\n    wait until <(NIVEAU) = [5]>\n    wait until <(Clé trouvée) = [1]>\n    delete this clone\nend\n\nwhen I start as a clone\nif <(costume [name v]) = [niveau 7 barrières]> then\n    wait until <(NIVEAU) = [7]>\n    wait until <(Clé trouvée) = [2]>\n    delete this clone\nend\n\n@Pièces\n\nwhen I receive [drapeau vert v]\nhide\n\nwhen I receive [tick v]\nPosition ((X) - (Défilement X)) ((Y) - (Défilement Y))\nif <touching (joueur v)?> then\n    change [pièces v] by (1)\n    broadcast (Piece collectée v)\n    if <(Pièces) = (Pièces MAX)> then\n        broadcast (Ouvrir le Portail v)\n    end\n    delete this clone\nend\n\nwhen I receive [installer v]\nhide\nset [pièces v] to [0]\nset [pièces max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(NIVEAU) = [1]> then\n    switch costume to (pièce v)\n    Clone à X : [190] Y : [-65]\n    Clone à X : [510] Y : [0]\n    Clone à X : [440] Y : [-90]\n    Clone à X : [790] Y : [-90]\n    Clone à X : [890] Y : [-90]\nelse\n    if <(NIVEAU) = [2]> then\n        Clone à X : [-130] Y : [-40]\n        Clone à X : [200] Y : [70]\n        Clone à X : [200] Y : [380]\n        Clone à X : [470] Y : [10]\n    else\n        if <(NIVEAU) = [3]> then\n            Clone à X : [0] Y : [0]\n            Clone à X : [300] Y : [100]\n            Clone à X : [100] Y : [-100]\n            Clone à X : [370] Y : [-100]\n            Clone à X : [800] Y : [10]\n        else\n            if <(NIVEAU) = [4]> then\n                Clone à X : [0] Y : [-15]\n                Clone à X : [400] Y : [100]\n                Clone à X : [600] Y : [150]\n            else\n                if <(NIVEAU) = [5]> then\n                    Clone à X : [-100] Y : [-100]\n                    Clone à X : [200] Y : [-100]\n                    Clone à X : [50] Y : [-100]\n                    Clone à X : [100] Y : [-100]\n                    Clone à X : [0] Y : [-100]\n                    Clone à X : [0] Y : [-50]\n                    Clone à X : [100] Y : [-50]\n                    Clone à X : [350] Y : [0]\n                else\n                    if <(NIVEAU) = [6]> then\n                        Clone à X : [400] Y : [-150]\n                    else\n                        if <(NIVEAU) = [7]> then\n                            Clone à X : [1100] Y : [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nset [x v] to [-99999]\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 [réinitialisation v]\ndelete this clone\n\ndefine Clone à X : (x) Y : (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [pièces max v] by (1)\ncreate clone of (_myself_ v)\n\n@Portail\n\nwhen I receive [drapeau vert v]\nhide\n\nwhen I receive [tick v]\nPosition ((X) - (Défilement X)) ((Y) - (Défilement Y))\nif <<(costume [name v]) = [Ouvert]> and <touching (joueur v)?>> then\n    set [sortie v] to [Fini]\nend\n\nwhen I receive [installer v]\nhide\nset [pièces v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(NIVEAU) = [1]> then\n    switch costume to (fermé v)\n    Clone à X : [1300] Y : [-20]\nelse\n    if <(NIVEAU) = [2]> then\n        switch costume to (fermé v)\n        Clone à X : [650] Y : [-20]\n    else\n        if <(NIVEAU) = [3]> then\n            switch costume to (fermé v)\n            Clone à X : [850] Y : [0]\n        else\n            if <(NIVEAU) = [4]> then\n                switch costume to (fermé v)\n                Clone à X : [-100] Y : [-100]\n            else\n                if <(NIVEAU) = [5]> then\n                    switch costume to (fermé v)\n                    Clone à X : [0] Y : [-200]\n                else\n                    if <(NIVEAU) = [6]> then\n                        switch costume to (fermé v)\n                        Clone à X : [600] Y : [100]\n                    else\n                        if <(NIVEAU) = [7]> then\n                            switch costume to (fermé v)\n                            Clone à X : [200] Y : [-200]\n                        else\n                            switch costume to (fermé v)\n                            Clone à X : [-44444444] 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 [réinitialisation v]\ndelete this clone\n\ndefine Clone à X : (x) Y : (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [ouvrir le portail v]\nswitch costume to (ouvert v)\n\nwhen flag clicked\nhide\nstop [this script v]\n\n@Clé\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <<<(NIVEAU) = [5]> and <not <(Clé trouvée) = [1]>>> or <<(NIVEAU) = [7]> and <not <(Clé trouvée) = [2]>>>> then\n        show\n    end\nelse\n    hide\nend\n\nwhen I receive [tick v]\nPosition ((x) - (Défilement X)) ((y) - (Défilement Y))\n\nwhen flag clicked\nset [clé trouvée v] to [0]\nhide\ngo to x: (-99999999999999) y: (1000)\n\ndefine Mettre clé à x: (x) y: (y)\nset [clé trouvée v] to [0]\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen backdrop switches to [arrière plan1 v]\nwait until <(NIVEAU) = [5]>\nset [clé trouvée v] to [0]\nMettre clé à x: [300] y: [200]\nshow\nwait until <(NIVEAU) = [7]>\nset [clé trouvée v] to [0]\nMettre clé à x: [2400] y: [150]\nshow\n\nwhen I receive [tick v]\nif <(NIVEAU) = [5]> then\n    if <touching (joueur v)?> then\n        hide\n        set [clé trouvée v] to [1]\n        delete this clone\n    end\nelse\n    if <(NIVEAU) = [7]> then\n        if <touching (joueur v)?> then\n            hide\n            set [clé trouvée v] to [2]\n            delete this clone\n        end\n    end\nend\n\n@GUI\n\nwhen this sprite clicked\nif <(Menu Gui) = [0]> then\n    switch costume to (1 v)\n    broadcast (Ouvrir GUI v)\n    set [menu gui v] to [1]\nelse\n    switch costume to (0 v)\n    broadcast (Fermer GUI v)\n    set [menu gui v] to [0]\nend\n\nwhen flag clicked\nset [menu gui v] to [0]\nswitch costume to (0 v)\n\nwhen flag clicked\nhide\ngo to x: (217) y: (254)\nwait until <(backdrop [number v]) = [2]>\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        if <not <(Menu Gui) = [1]>> then\n            switch costume to (1 v)\n            wait until <<not <touching (mouse-pointer v)?>> or <(Menu Gui) = [1]>>\n            if <not <(Menu Gui) = [1]>> then\n                switch costume to (0 v)\n            end\n        end\n    end\nend\n\n@Skip\n\nwhen flag clicked\nswitch costume to (0 v)\n\nwhen flag clicked\ngo to x: (181) y: (254)\nhide\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (1 v)\n        wait until <not <touching (mouse-pointer v)?>>\n        switch costume to (0 v)\n    end\nend\n\nwhen I receive [ouvrir gui v]\nshow\nswitch costume to (0 v)\n\nwhen I receive [fermer gui v]\nhide\n\nwhen this sprite clicked\nif <not <(NIVEAU) = [8]>> then\n    broadcast (Niveau suivant v)\nend\n\n@Restart\n\nwhen this sprite clicked\nbroadcast (Jouer v)\n\nwhen flag clicked\ngo to x: (147) y: (254)\nhide\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (1 v)\n        wait until <not <touching (mouse-pointer v)?>>\n        switch costume to (0 v)\n    end\nend\n\nwhen I receive [ouvrir gui v]\nshow\nswitch costume to (0 v)\n\nwhen I receive [fermer gui v]\nhide\n\nwhen flag clicked\nswitch costume to (0 v)\n\n@Musique\n\nwhen flag clicked\nwait until <(backdrop [number v]) = [2]>\nforever\n    play sound [Itro & Tobu - Cloud 9 \[NCS Release\] v] until done\nend\n\nwhen flag clicked\ngo to x: (110) y: (254)\nhide\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(costume [number v]) = [1]> then\n            switch costume to (1 v)\n        else\n            switch costume to (3 v)\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n        if <(costume [number v]) = [2]> then\n            switch costume to (0 v)\n        else\n            switch costume to (2 v)\n        end\n    end\nend\n\nwhen flag clicked\nswitch costume to (0 v)\ngo to [back v] layer\nset volume to (100) %\nstop all sounds\n\nwhen this sprite clicked\nif <(costume [number v]) = [2]> then\n    set volume to (0) %\n    switch costume to (2 v)\nelse\n    set volume to (100) %\n    switch costume to (1 v)\nend\n\nwhen I receive [ouvrir gui v]\nshow\n\nwhen I receive [fermer gui v]\nhide\n\n@FX\n\nwhen I receive [mort v]\nplay sound [Oops v] until done\n\nwhen I receive [piece collectée v]\nplay sound [Collect v] until done\n\nwhen flag clicked\nswitch costume to (0 v)\n\nwhen flag clicked\ngo to x: (73) y: (254)\nhide\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(costume [number v]) = [1]> then\n            switch costume to (1 v)\n        else\n            switch costume to (3 v)\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n        if <(costume [number v]) = [2]> then\n            switch costume to (0 v)\n        else\n            switch costume to (2 v)\n        end\n    end\nend\n\nwhen flag clicked\ngo to [back v] layer\nset volume to (100) %\nstop all sounds\nswitch costume to (costume1 v)\n\nwhen this sprite clicked\nif <(costume [number v]) = [2]> then\n    set volume to (0) %\n    switch costume to (2 v)\nelse\n    set volume to (100) %\n    switch costume to (1 v)\nend\n\nwhen I receive [ouvrir gui v]\nshow\nswitch costume to (0 v)\n\nwhen I receive [fermer gui v]\nhide\n\n