Speedy Platformer

Instructions: - Hi & Welcome to a game called "Speedy Platformer" \n\n- Use the arrow keys to move\n\n- Avoid spikes!

@Stage\n\nwhen flag clicked\nhide variable [time v]\nhide variable [deaths v]\nset [time v] to [0]\nswitch backdrop to (1 v)\n\nwhen I receive [next level v]\nif <(Level) = [10]> then\n    switch backdrop to (10 v)\nend\n\nwhen I receive [play v]\nset [time v] to [0]\nshow variable [time v]\nrepeat until <(Level) = [11]>\n    wait (0.1) seconds\n    change [time v] by (0.1)\nend\nhide variable [time v]\nif <(Skiped?) = [1]> then\n    wait (0.2) seconds\n    set [time v] to ((Time) + (10))\nelse\n    wait (0.2) seconds\n    set [time v] to ((Time) - (10))\nend\nshow variable [time v]\nshow variable [deaths v]\n\nwhen I receive [win! v]\nswitch backdrop to (2 v)\n\nwhen I receive [dead v]\nchange [deaths v] by (1)\nwait (0.3) seconds\n\n@Hitbox\n\nwhen flag clicked\nset [level v] to [1]\nset [p1 movement v] to [0]\nhide\nwait (0.2) seconds\npoint in direction (90)\ngo to x: (-220) y: (-50)\nswitch costume to (1 v)\nshow\nset size to (100) %\nset rotation style [left-right v]\nset [ghost v] effect to (100)\nset [xv v] to [0]\nset [yv v] to [0]\n\nwhen I receive [play v]\nforever\n    if <touching (nets v)?> then\n        repeat until <not <touching (nets v)?>>\n            set [yv v] to [-0.1]\n            set [xv v] to ((Xv) / (2))\n        end\n    end\nend\n\nwhen I receive [next level v]\nRespawn\n\nwhen I receive [play v]\nset [speed boozt? v] to [0]\nforever\n    if <touching (water v)?> then\n        repeat until <not <touching (water v)?>>\n            set [xv v] to ((Xv) / (2))\n            set [yv v] to ((Yv) / (2))\n        end\n    end\nend\n\nwhen I receive [speed boozt v]\nif <(Level) = [9]> then\n    repeat until <(Level) = [10]>\n        set [speed boozt? v] to [1]\n    end\n    set [speed boozt? v] to [0]\nelse\n    set [speed boozt? v] to [1]\nend\n\ndefine Respawn\nset [p1 movement v] to [0]\nhide\nwait (0.2) seconds\npoint in direction (90)\nset [p1 movement v] to [1]\ngo to x: (-220) y: (-50)\nswitch costume to (1 v)\nshow\nset size to (100) %\nset rotation style [left-right v]\nset [ghost v] effect to (100)\nset [xv v] to [0]\nset [yv v] to [0]\n\nwhen I receive [play v]\nforever\n    if <touching (spikes v)?> then\n        broadcast (Dead v)\n        Respawn\n    end\nend\n\nwhen I receive [p1 bounce v]\nset [yv v] to [20]\n\nwhen I receive [play v]\nRespawn\nforever\n    if <(P1 Movement) = [1]> then\n        if <key (right arrow v) pressed?> then\n            if <not <<touching (ladders v)?> and <key (up arrow v) pressed?>>> then\n                if <(Speed Boozt?) = [1]> then\n                    change [xv v] by (1.2)\n                else\n                    change [xv v] by (0.65)\n                end\n            end\n        end\n        if <key (left arrow v) pressed?> then\n            if <not <<touching (ladders v)?> and <key (up arrow v) pressed?>>> then\n                if <(Speed Boozt?) = [1]> then\n                    change [xv v] by (-1.2)\n                else\n                    change [xv v] by (-0.65)\n                end\n            end\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (1)\n                            if <touching (ground v)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                if <(P1 Movement) = [1]> then\n                                    if <key (up arrow v) pressed?> then\n                                        if <(Xv) > [0]> then\n                                            set [xv v] to [-5]\n                                        else\n                                            set [xv v] to [5]\n                                        end\n                                        set [yv v] to [11]\n                                    else\n                                        set [xv v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching (ground v)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching (ground v)?> then\n            if <key (up arrow v) pressed?> then\n                if <(P1 Movement) = [1]> then\n                    set [yv v] to [11]\n                end\n            end\n        end\n        change y by (1)\n    end\nend\n\nwhen I receive [play v]\nwait (0.3) seconds\nforever\n    if <not <(Level) = [11]>> then\n        if <(x position) > [240]> then\n            if <not <(Level) = [11]>> then\n                change [level v] by (1)\n            end\n            broadcast (Next Level v)\n            Respawn\n        end\n    end\nend\n\nwhen I receive [next level v]\n\nif <(Level) = [11]> then\n    Respawn\nend\n\n@Ground\n\nwhen flag clicked\nset [skiped? v] to [0]\nset [deaths v] to [0]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nif <(costume [number v]) = [10]> then\n    broadcast (win! v)\n    switch costume to (11 v)\nelse\n    next costume\nend\n\nwhen flag clicked\nforever\n    play sound [OTR 1 v] until done\n    play sound [OTR 2 v] until done\nend\n\nwhen I receive [play v]\nset [skiped? v] to [0]\nwait until <(Level) = [10]>\nrepeat until <(Level) = [11]>\n    if <key (space v) pressed?> then\n        set [skiped? v] to [1]\n        set [level v] to [11]\n        broadcast (next level v)\n    end\nend\n\n@Player\n\nwhen flag clicked\nhide\nset [locked? v] to [1]\nset rotation style [left-right v]\npoint in direction (90)\ngo to [front v] layer\nrepeat (5)\n    go to (hitbox v)\nend\n\nwhen I receive [play v]\nforever\n    if <not <<key (up arrow v) pressed?> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>>> then\n        switch costume to (1 v)\n        wait (pick random (2) to (4)) seconds\n        if <not <<key (up arrow v) pressed?> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>>> then\n            if <(Locked?) = [0]> then\n                set [locked? v] to [1]\n                switch costume to (2 v)\n                wait (0.05) seconds\n                switch costume to (3 v)\n                wait (0.05) seconds\n                switch costume to (2 v)\n                wait (0.05) seconds\n                switch costume to (1 v)\n                wait (0.05) seconds\n                set [locked? v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <not <touching (ground v)?>> then\n        if <(Locked?) = [0]> then\n            set [locked? v] to [1]\n            switch costume to (10 v)\n            wait until <touching (ground v)?>\n            switch costume to (1 v)\n            set [locked? v] to [0]\n        end\n    end\nend\n\nwhen I receive [dead v]\nhide\nswitch costume to (1 v)\ngo to (hitbox v)\nwait (0.2) seconds\ngo to (hitbox v)\nshow\n\nwhen I receive [next level v]\nhide\nswitch costume to (1 v)\ngo to (hitbox v)\nwait (0.2) seconds\ngo to (hitbox v)\nshow\n\nwhen I receive [next level v]\nif <(Level) = [7]> then\n    repeat (3)\n        go [backward v] ([10 ^ v] of (9) ) layers\n    end\n    wait until <(Level) = [8]>\n    go to [front v] layer\nend\n\nwhen I receive [play v]\nforever\n    if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n        if <(Locked?) = [0]> then\n            set [locked? v] to [1]\n            switch costume to (4 v)\n            repeat (3)\n                wait (0.05) seconds\n                next costume\n            end\n            repeat (3)\n                wait (0.05) seconds\n                switch costume to ((costume [number v]) - (1))\n            end\n            wait (0.05) seconds\n            switch costume to (1 v)\n            set [locked? v] to [0]\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n    end\nend\n\nwhen I receive [play v]\ngo to [front v] layer\nset [level v] to [1]\nset rotation style [left-right v]\npoint in direction (90)\nset [locked? v] to [0]\nshow\nforever\n    go to (hitbox v)\nend\n\n@Spikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\ngo [backward v] ([10 ^ v] of (9) ) layers\n\nwhen I receive [win! v]\nhide\n\nwhen I receive [next level v]\nnext costume\nwait (1) seconds\n\n@Trampoline\n\nwhen I receive [play v]\nwait until <(Level) = [4]>\ncreate clone of (_myself_ v)\ngo to x: (-133) y: (-133)\nshow\nswitch costume to (1 v)\ngo [backward v] ([10 ^ v] of (5) ) layers\nrepeat until <(Level) = [5]>\n    if <touching (hitbox v)?> then\n        Bounce\n    end\nend\ngo to x: (-60) y: (-88)\nshow\nswitch costume to (1 v)\nrepeat until <(Level) = [6]>\n    if <touching (hitbox v)?> then\n        Bounce\n    end\nend\nhide\nwait until <(Level) = [11]>\ngo to x: (-124) y: (-133)\nshow\nswitch costume to (1 v)\nforever\n    if <touching (hitbox v)?> then\n        Bounce\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine Bounce\nswitch costume to (2 v)\nbroadcast (p1 bounce v)\nwait (0.02) seconds\nswitch costume to (3 v)\nwait (0.02) seconds\nswitch costume to (2 v)\nwait (0.02) seconds\nswitch costume to (1 v)\n\nwhen I start as a clone\ngo to x: (15) y: (-133)\nshow\nswitch costume to (1 v)\ngo [backward v] ([10 ^ v] of (4) ) layers\nrepeat until <(Level) = [5]>\n    if <touching (hitbox v)?> then\n        Bounce\n    end\nend\nhide\ndelete this clone\n\n@Water\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nhide\nwait until <(Level) = [7]>\nset [ghost v] effect to (50)\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nrepeat (2)\n    go [backward v] ([10 ^ v] of (4) ) layers\nend\nwait until <(Level) = [8]>\nhide\n\n@Speed Boozt\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nhide\nwait until <(Level) = [9]>\ngo to x: (-195) y: (-150)\ngo to [front v] layer\nswitch costume to (1 v)\nshow\ngo [backward v] (50) layers\nrepeat until <(Level) = [10]>\n    if <touching (hitbox v)?> then\n        Speed Boozt\n        wait until <not <touching (hitbox v)?>>\n        wait (0.1) seconds\n    end\nend\nhide\nwait until <(Level) = [11]>\ngo to x: (50) y: (-150)\ngo to [front v] layer\nswitch costume to (1 v)\nshow\ngo [backward v] (50) layers\nforever\n    if <touching (hitbox v)?> then\n        Speed Boozt\n        wait until <not <touching (hitbox v)?>>\n        wait (0.1) seconds\n    end\nend\n\ndefine Speed Boozt\nswitch costume to (1 v)\nbroadcast (speed boozt v)\nrepeat (20)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nwait (0.3) seconds\nrepeat (5)\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nhide\nswitch costume to (2 v)\nset [ghost v] effect to (50)\ngo [backward v] ([10 ^ v] of (7) ) layers\ngo to (([x position v] of [speed boozt v]) + ([y position v] of [speed boozt v]))\nchange x by (pick random (-35) to (35))\nshow\nrepeat (15)\n    change y by (7)\nend\n\n@Start!\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nclear graphic effects\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (110) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen flag clicked\nwait (0.2) seconds\nwait until <<<mouse down?> and <touching (mouse-pointer v)?>> or <key (space v) pressed?>>\nhide\nwait (0.2) seconds\nbroadcast (PLAY v)\n\n@Cover\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    wait (0.3) seconds\nend\n\n@Result\n\nwhen flag clicked\nhide\nhide variable [☁ world record time v]\n\nwhen I receive [win! v]\nwait (0.5) seconds\nshow variable [☁ world record time v]\nif <(Time) < (☁ World Record Time)> then\n    set [☁ world record time v] to (Time)\nend\n\n