No Going Back - Platformer


@Stage\n\n@Player\n\nwhen flag clicked\nshow\ngo to x: (-216) y: (-74)\nswitch costume to (player  v)\ngo [forward v] (100) layers\nforever\n    if <(y position) = [-179]> then\n        switch costume to (player  v)\n        broadcast (Respawn v)\n        go to x: (-216) y: (-74)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        switch costume to (player right v)\n        change [x v] by (1)\n    end\n    set [x v] to ((X) * (0.9))\n    change x by (X)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change x by ((X) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(X) > [0]> then\n                                    set [x v] to [-5]\n                                else\n                                    set [x v] to [5]\n                                end\n                                set [y v] to [10]\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (Y)\n    if <touching (level v)?> then\n        change y by ((Y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y v] to [15]\n            switch costume to (player up v)\n            start sound [Jump v]\n        end\n    end\n    change y by (1)\n    if <touching (obstacles v)?> then\n        broadcast (Respawn v)\n        go to x: (-210) y: (-74)\n        switch costume to (player v)\n        start sound [Bonk v]\n    end\n    if <(x position) > [230]> then\n        go to x: (-216) y: (-74)\n        change [level v] by (1)\n        switch costume to (player v)\n        start sound [Next Level v]\n    end\n    if <touching (trampoline v)?> then\n        set [y v] to [24]\n        switch costume to (player up v)\n        start sound [Big Boing v]\n    end\n    if <touching (speed boost v)?> then\n        set [x v] to [25]\n        start sound [Next Level v]\n    end\nend\n\nwhen I receive [restart level v]\ngo to x: (-216) y: (30)\nswitch costume to (player  v)\n\n@Level\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [level v] to [1]\nforever\n    switch costume to (Level)\nend\n\n@Background\n\nwhen flag clicked\nswitch costume to (sky v)\ngo to x: (0) y: (0)\ngo to [back v] layer\nshow\n\nwhen flag clicked\nforever\n    if <<<<(Level) = [14]> or <(Level) = [15]>> or <(Level) = [16]>> or <(Level) = [17]>> then\n        switch costume to (sewer v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [18]> then\n        switch costume to (sewer light v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [19]> then\n        switch costume to (sky v)\n    end\nend\n\n@Trees\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Text\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Mountains\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [back v] layer\nset [ghost v] effect to (50)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    if <<<<<(Level) = [9]> or <(Level) = [10]>> or <(Level) = [11]>> or <<<(Level) = [12]> or <(Level) = [13]>> or <(Level) = [14]>>> or <(Level) = [15]>> then\n        hide\n    end\nend\n\n@Obstacles\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nforever\n    switch costume to (Level)\nend\n\n@Warning Sign\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Trampoline\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Speed Boost\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\n@Buildings\n\nwhen flag clicked\nshow\ngo to [back v] layer\ngo to x: (0) y: (0)\nset [ghost v] effect to (50)\nforever\n    switch costume to (Level)\nend\n\n@Restart Button\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        broadcast (Restart Level v)\n        wait (1) seconds\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\n@Shadows\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (50)\nforever\n    switch costume to (Level)\nend\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [bensound-perception \(1\) v] until done\nend\n\n