~Fly~ #Platformer

Instructions: ------------------5 LEVELS OF IMPOSSIBLE-------------\n---------------------------------------------------------------\nUse W, A, S, D, or Arrow Keys. All levels are beatable. This is a game about a bird trying to escape the fly islands by collecting 5 keys. Don't touch the poisonous mushrooms. 

@Stage\n\nwhen flag clicked\nforever\n    play sound [Mission Impossible Theme Song \(8-bit\) v] until done\nend\n\n@Character\n\nwhen flag clicked\nbroadcast (Play v)\nreset timer\n\ndefine Platform (jump height) (gravity) (friction) (running speed)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x velocity v] by (running speed)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x velocity v] by ((running speed) * (-1))\nend\nset [x velocity v] to ((X velocity) * (friction))\nchange x by (X velocity)\nif <touching (ground v)?> then\n    set [slope v] to [0]\n    repeat until <<(Slope) = [8]> or <not <touching (ground v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (ground v)?> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (X velocity) ) )\n            if <touching (ground v)?> then\n                change x by ((([abs v] of (X velocity) ) / (X velocity)) * (-1))\n            end\n        end\n        set [x velocity v] to [0]\n    end\nend\nchange y by (Y velocity)\nif <touching (ground v)?> then\n    repeat ([ceiling v] of ([abs v] of (Y velocity) ) )\n        if <touching (ground v)?> then\n            change y by ((([abs v] of (Y velocity) ) / (Y velocity)) * (-1))\n        end\n    end\n    if <<(([abs v] of (Y velocity) ) / (Y velocity)) = [-1]> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y velocity v] to (jump height)\n    else\n        set [y velocity v] to [0]\n    end\nelse\n    change [y velocity v] by (-1)\nend\n\nwhen I receive [play v]\nshow\ngo to x: (-200) y: (0)\nforever\n    Platform [7] [-1] [0.7] [1]\n    if <<touching (_edge_ v)?> or <touching (spikes v)?>> then\n        play sound [Hit_Hurt96 v] until done\n        go to x: (-200) y: (0)\n        set [x velocity v] to [0]\n        set [y velocity v] to [0]\n    end\n    if <not <(Level) = [6]>> then\n        if <touching (checkpoint v)?> then\n            play sound [sfx v] until done\n            change [level v] by (1)\n            go to x: (-200) y: (0)\n            set [x velocity v] to [0]\n            set [y velocity v] to [0]\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    set [display v] to (round (timer))\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        switch costume to (jump1 v)\n        wait (0.1) seconds\n        switch costume to (jump2 v)\n        wait (0.1) seconds\n        switch costume to (jump3 v)\n        wait (0.1) seconds\n        switch costume to (jump4 v)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        switch costume to (run1 v)\n        wait (0.1) seconds\n        switch costume to (run2 v)\n        wait (0.1) seconds\n        switch costume to (run3 v)\n        wait (0.1) seconds\n        switch costume to (run4 v)\n        wait (0.1) seconds\n        switch costume to (run5 v)\n        wait (0.1) seconds\n        switch costume to (run6 v)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        switch costume to (run1 v)\n        wait (0.1) seconds\n        switch costume to (run2 v)\n        wait (0.1) seconds\n        switch costume to (run3 v)\n        wait (0.1) seconds\n        switch costume to (run4 v)\n        wait (0.1) seconds\n        switch costume to (run5 v)\n        wait (0.1) seconds\n        switch costume to (run6 v)\n    end\n    if <not <key (any v) pressed?>> then\n        switch costume to (idle1 v)\n        wait (0.1) seconds\n        switch costume to (idle2 v)\n        wait (0.1) seconds\n        switch costume to (idle3 v)\n        wait (0.1) seconds\n        switch costume to (idle4 v)\n    end\nend\n\nwhen flag clicked\nset size to (150) %\npoint in direction (90)\n\n@Ground\n\nwhen flag clicked\nreset timer\nset [score v] to [0]\nset [level v] to [1]\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [play v]\nforever\n    if <(Level) = [6]> then\n        broadcast (Win v)\n        set [score v] to (timer)\n        stop [this script v]\n    end\nend\n\nwhen I receive [win v]\nif <(Score) < (☁ Highscore)> then\n    set [☁ highscore v] to (Score)\nend\n\nset [display v] to (round (timer))\n\nwhen flag clicked\nset size to (150) %\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\ngo [forward v] (1) layers\n\n@Spikes\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nset size to (150) %\n\nwhen flag clicked\nset size to (150) %\n\nwhen flag clicked\ngo to x: (103) y: (8)\nshow\n\n@Checkpoint\n\nwhen I receive [play v]\nshow\nforever\n    repeat (10)\n        change y by (.5)\n    end\n    repeat (10)\n        change y by (-.5)\n    end\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [play v]\nset [brightness v] effect to (0)\nforever\n    change [brightness v] effect by (-25)\n    wait (.5) seconds\n    change [brightness v] effect by (25)\n    wait (.5) seconds\nend\n\nrepeat (15)\n    change y by (.1)\nend\nrepeat (15)\n    change y by (-.1)\nend\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch costume to (Level)\nend\n\nchange [level v] by (1)\n\nwhen flag clicked\nset size to (100) %\n\n@values\n\nwhen flag clicked\nforever\n    set [date v] to (join (join (join (join (current [month v]) [/]) (current [date v])) [/]) (current [year v]))\nend\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    erase all\n    Instant Print (Display) at X: [-225] Y: [165] Size [19] Spacing [12]\nend\n\ndefine Instant Print (string1) at X: (x) Y: (y) Size (size) Spacing (spacing)\nhide\nset size to (size) %\ngo to x: (x) y: (y)\nset [currentletter v] to [1]\nrepeat (length of (string1))\n    switch costume to (letter (currentLetter) of (string1))\n    show\n    stamp\n    hide\n    change x by (spacing)\n    change [currentletter v] by (1)\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nerase all\nInstant Print (join [SCORE: ] (Score)) at X: (-150) Y: (165) Size [12] Spacing [9]\nwait (0.5) seconds\nInstant Print (join [HIGHSCORE: ] (☁ Highscore)) at X: (50) Y: (165) Size [12] Spacing [9]\n\n@Glow\n\nwhen flag clicked\nset [ghost v] effect to (40)\ngo to [back v] layer\nhide\n\n@ICON\n\nwhen flag clicked\nhide\n\n