Pi (A Platformer)

Instructions: Yay! This is my second scrolling platformer! This is also a sequl to "School - A Scrolling Platformer" which can be found here: https://scratch.mit.edu/projects/421559571/\n\n\nDont touch red! Arrow keys to move and also dont fall off the ground.\n\n

@Stage\n\nwhen I receive [intro ready v]\n\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (0.5) seconds\n\nset [ghost v] effect to (100)\nswitch backdrop to (backdrop3 v)\n\nwhen flag clicked\nshow\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [play v]\nforever\n    play sound [POL-the-foyer-short v] until done\nend\n\n@Sprite1\n\nwhen I start as a clone\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (y vel)\nif <touching (ground v)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching (ground v)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <<key (w v) pressed?> or <touching (bounce v)?>>> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x vel v] by (movement speed)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x vel v] by ((-1) * (movement speed))\nend\nchange x by (x vel)\nif <touching (ground v)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (ground v)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching (ground v)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            if <(x vel) < [0]> then\n                set [x vel v] to [0]\n                if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                    set [x vel v] to (wall jump hm)\n                    set [y vel v] to (wall jump vm)\n                end\n            else\n                set [x vel v] to [0]\n                if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                    set [x vel v] to ((-1) * (wall jump hm))\n                    set [y vel v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\ngo to x: (-200) y: (-108)\nshow\nset [y vel v] to [0]\nset [y vel v] to [0]\nset [level v] to [1]\nforever\n    platform physics (12) (-1) (0.9) (1) (8) (8)\nend\n\nwhen I receive [play v]\nforever\n    if <touching (obstalces v)?> then\n        go to x: (-200) y: (-108)\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <touching (_edge_ v)?> then\n        change [level v] by (1)\n        go to x: (-191) y: (-86)\n    end\nend\n\nwhen I receive [play v]\nforever\n    create clone of (_myself_ v)\n    wait (0.05) seconds\nend\n\nwhen I receive [play v]\nshow variable [time v]\nshow variable [level v]\nset [time v] to [0]\nforever\n    if <(Level) > [12]> then\n        change [time v] by (0)\n    else\n        change [time v] by (1)\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <(Level) = [13]> then\n        if <(Time) < [50]> then\n        end\n    end\nend\n\nwhen flag clicked\nhide variable [time v]\nhide variable [level v]\n\n@pixil-frame-0 (35)\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nwait (1) seconds\nglide (1) secs to x: (-157) y: (0)\nstart sound [Intro v]\nbroadcast (Logo Ready v)\n\nwhen I receive [intro ready v]\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nhide\nwait (1) seconds\nbroadcast (Play v)\n\n@LOGOname\n\nwhen I receive [line ready v]\ngo to x: (89) y: (-3)\nshow\nrepeat (100)\n    change [ghost v] effect by (-2)\nend\nbroadcast (Intro Ready v)\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nhide\n\nwhen I receive [intro ready v]\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nhide\n\n@Line\n\nwhen I receive [logo ready v]\nshow\ngo to x: (-75) y: (33)\nbroadcast (Line Ready v)\n\nwhen flag clicked\nhide\n\nwhen I receive [intro ready v]\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nhide\n\n@Ground\n\nwhen I receive [play v]\nforever\n    if <(Level) = [1]> then\n        switch costume to (level 1 v)\n    end\n    if <(Level) = [2]> then\n        switch costume to (level 2 v)\n    end\n    if <(Level) = [3]> then\n        switch costume to (level 3 v)\n    end\n    if <(Level) = [4]> then\n        switch costume to (level 4 v)\n    end\n    if <(Level) = [5]> then\n        switch costume to (level 5 v)\n    end\n    if <(Level) = [6]> then\n        switch costume to (level 6 v)\n    end\n    if <(Level) = [7]> then\n        switch costume to (level 7 v)\n    end\n    if <(Level) = [8]> then\n        switch costume to (level 8 v)\n    end\n    if <(Level) = [9]> then\n        switch costume to (level 9 v)\n    end\n    if <(Level) = [10]> then\n        switch costume to (level 10 v)\n    end\n    if <(Level) = [11]> then\n        switch costume to (level 11 v)\n    end\n    if <(Level) = [12]> then\n        switch costume to (level 12 v)\n    end\n    if <(Level) = [13]> then\n        switch costume to (level 13 v)\n        hide variable [level v]\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [play v]\nforever\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    repeat (50)\n        change [ghost v] effect by (2)\n    end\n    wait (3) seconds\nend\n\n@obstalces\n\nhide\n\nwhen I receive [play v]\nforever\n    if <(Level) = [1]> then\n        hide\n    end\n    if <(Level) = [2]> then\n        hide\n    end\n    if <(Level) = [3]> then\n        show\n        go to x: (86) y: (-88)\n        switch costume to (level 3 ob v)\n    end\n    if <(Level) = [4]> then\n        show\n        go to x: (87) y: (-88)\n        switch costume to (level 4 ob v)\n    end\n    if <(Level) = [5]> then\n        show\n        go to x: (87) y: (-88)\n        switch costume to (level 5 ob v)\n    end\n    if <(Level) = [6]> then\n        show\n        go to x: (87) y: (-88)\n        switch costume to (level 6 ob v)\n    end\n    if <(Level) = [7]> then\n        show\n        go to x: (-71) y: (-63)\n        switch costume to (level 7 ob v)\n    end\n    if <(Level) = [8]> then\n        hide\n    end\n    if <(Level) = [9]> then\n        hide\n    end\n    if <(Level) = [10]> then\n        show\n        go to x: (0) y: (0)\n        switch costume to (level 10 ob2 v)\n    end\n    if <(Level) = [11]> then\n        show\n        go to x: (0) y: (0)\n        switch costume to (level 11 ob v)\n    end\n    if <(Level) = [12]> then\n        show\n        go to x: (0) y: (0)\n        switch costume to (level 12 ob2 v)\n    end\n    if <(Level) = [13]> then\n        hide\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (1) y: (215)\nhide\n\nwhen I receive [play v]\nforever\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    repeat (50)\n        change [ghost v] effect by (2)\n    end\n    wait (3) seconds\nend\n\n@Bounce\n\nwhen flag clicked\nhide\n\nhide\n\nwhen I receive [play v]\nforever\n    if <(Level) = [1]> then\n        show\n        go to x: (-112) y: (-126)\n    end\n    if <(Level) = [2]> then\n        hide\n    end\n    if <(Level) = [3]> then\n        hide\n    end\n    if <(Level) = [4]> then\n        hide\n    end\n    if <(Level) = [5]> then\n        hide\n    end\n    if <(Level) = [6]> then\n        hide\n    end\n    if <(Level) = [7]> then\n        show\n        go to x: (-87) y: (-97)\n    end\n    if <(Level) = [8]> then\n        show\n        go to x: (6) y: (-120)\n    end\n    if <(Level) = [9]> then\n        hide\n    end\n    if <(Level) = [10]> then\n        hide\n    end\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\nwhen I receive [play v]\nforever\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    repeat (50)\n        change [ghost v] effect by (2)\n    end\n    wait (3) seconds\nend\n\n@tHUMBNAIl\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\n\nset [☁ world record v] to [5000]\n\n