ElectroBox - A Puzzle Platformer

Instructions: WASD, arrow keys / press x to skip a level\n\n\n

@Stage\n\nwhen flag clicked\nclear graphic effects\nswitch backdrop to (backdrop1 v)\nforever\n    set volume to (100) %\n    play sound [85046_newgrounds_parago.mp3 v] until done\nend\n\n@Main Character\n\nwhen flag clicked\nset [||level|| v] to [1]\nhide\nhide variable [distance v]\n\nwhen I receive [start v]\nset [distance v] to [0]\nset [dead? v] to [0]\nset [y vel v] to [0]\nhide variable [distance v]\nset [scrollx v] to [0]\nswitch costume to (costume1 v)\ngo to x: (-200) y: (-80)\nforever\n    if <(||LEVEL||) = [11]> then\n        hide\n        stop [this script v]\n    else\n        set size to (100) %\n        ConvertUsername\n        physics (12) (0.8)\n        if <<(y position) < [-170]> or <touching (lava v)?>> then\n            go to x: (-200) y: (-80)\n            broadcast (Fall v)\n        end\n        if <touching (sprite2 v)?> then\n            go to x: (-200) y: (-80)\n            broadcast (Next Level v)\n            change [||level|| v] by (1)\n        end\n        if <key (r v) pressed?> then\n            go to x: (-200) y: (-80)\n            broadcast (Fall v)\n        end\n    end\nend\n\nwhen I receive [start v]\nshow\nforever\n    if <(Dead?) = [0]> then\n        wait (0.1) seconds\n        change [distance v] by (1)\n    else\n        set [distance v] to (Distance)\n    end\nend\n\ndefine ConvertUsername\nset [username v] to (username)\nset [characters v] to [abcdefghijklmnopqrstuvwxyz01234567890_-"'.,?!@~{}\[\]\(\)*/\£$%^&+=]\nset [convertusername v] to (username)\nset [count1 v] to [0]\nrepeat (length of (username))\n    change [count1 v] by (1)\n    set [count2 v] to [0]\n    repeat until <<(letter (Count2) of (Characters)) = (letter (Count1) of (username))> or <(Count2) > (length of (Characters))>>\n        change [count2 v] by (1)\n    end\n    if <(Count2) < [9.5]> then\n        add (join [0] (Count2)) to [usernamerec v]\n    else\n        add (Count2) to [usernamerec v]\n    end\nend\nset [convertusername v] to (item (1) of [usernamerec v])\ndelete (1) of [usernamerec v]\nrepeat (length of [usernamerec v])\n    set [convertusername v] to (join (ConvertUsername) (item (1) of [usernamerec v]))\n    delete (1) of [usernamerec v]\nend\n\ndefine None\nchange y by (y vel)\nif <touching (spring v)?> then\n    set [y vel v] to ((jump height) * (1.35))\nend\nif <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n    repeat ([abs v] of (y vel) )\n        if <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n            change y by (((y vel) / ([abs v] of (y vel) )) * (-1))\n        end\n    end\n    if <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n        change y by (y vel)\n    end\n    if <<(y vel) < [0.01]> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        if <touching (spring v)?> then\n            set [y vel v] to ((jump height) * (1.35))\n        else\n            set [y vel v] to (jump height)\n        end\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (-1)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x vel v] by (1)\n    point in direction (90)\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x vel v] by (-1)\n        point in direction (-90)\n    else\n    end\nend\nchange x by (x vel)\nif <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n    repeat ([ceiling v] of (([abs v] of (x vel) ) + (1)) )\n        if <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n            change x by (((x vel) / ([abs v] of (x vel) )) * (-1))\n        end\n    end\n    if <<touching (terrain v)?> or <<touching (fall block v)?> or >> then\n        change x by (([ceiling v] of ([abs v] of (x vel) ) ) * ((x vel) / ([abs v] of (x vel) )))\n    end\n    set [x vel v] to [0]\nend\nif <touching (spring v)?> then\n    set [y vel v] to ((jump height) * (1.35))\nend\nset [x vel v] to ((x vel) * (friction))\nswitch costume to (1 v)\n\n@Sprite1\n\nwhen I receive [start v]\nwait (1.4) seconds\nshow\nset [distance v] to [0]\nerase all\nforever\n    set size to (150) %\n    go to [front v] layer\n    go to x: (-230) y: (165)\n    set [c v] to [1]\n    erase all\n    switch costume to ((letter (C) of (Distance)) + (1))\n    change [c v] by (1)\n    stamp\n    if <(length of (Distance)) > [1]> then\n        change x by (20)\n        switch costume to ((letter (C) of (Distance)) + (1))\n        change [c v] by (1)\n        stamp\n    end\n    if <(length of (Distance)) > [2]> then\n        change x by (20)\n        switch costume to ((letter (C) of (Distance)) + (1))\n        change [c v] by (1)\n        stamp\n    end\n    if <(length of (Distance)) > [3]> then\n        change x by (20)\n        switch costume to ((letter (C) of (Distance)) + (1))\n        change [c v] by (1)\n        stamp\n    end\n    if <(length of (Distance)) > [4]> then\n        change x by (20)\n        switch costume to ((letter (C) of (Distance)) + (1))\n        change [c v] by (1)\n        stamp\n    end\n    if <(length of (Distance)) > [5]> then\n        change x by (20)\n        switch costume to ((letter (C) of (Distance)) + (1))\n        change [c v] by (1)\n        stamp\n    end\nend\n\nwhen flag clicked\nhide\nerase all\n\nwhen I receive [dead v]\nhide\nerase all\n\n@CLOUD\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\ndefine ConvertHiscore\nset [converthiscore v] to []\nset [count1 v] to [0]\nrepeat (length of (☁ HiscoreUsername))\n    change [count1 v] by (1)\n    set [converthiscore v] to (join (ConvertHiscore) (letter (join (letter ((((Count1) - (1)) * (2)) + (1)) of (☁ HiscoreUsername)) (letter ((((Count1) - (1)) * (2)) + (2)) of (☁ HiscoreUsername))) of (Characters)))\nend\nset [converthiscore v] to (join (ConvertHiscore) (join [ : ] (☁ Highscore)))\n\nwhen I receive [dead v]\nif <(Distance) < (☁ Highscore)> then\n    set [☁ highscore v] to ((Distance) + (1))\n    set [☁ hiscoreusername v] to (ConvertUsername)\n    broadcast (HISCORE v)\nelse\nend\n\nwhen flag clicked\nwait (0.001) seconds\nset [dead? v] to [0]\nhide variable [convertusername v]\nhide variable [converthiscore v]\nswitch costume to (hud2 v)\nset [highestscore v] to [0]\nset [recglobalhighscore v] to [donotchange]\nhide variable [score v]\ngo to [front v] layer\nhide variable [converthiscore v]\nforever\n    if <(Distance) < (Highestscore)> then\n        set [highestscore v] to (Distance)\n    else\n    end\n    if <not <(recglobalhighscore) = (☁ Highscore)>> then\n        set [recglobalhighscore v] to (☁ Highscore)\n        ConvertHiscore\n    else\n    end\n    if <(Dead?) = [0]> then\n        hide\n    else\n        show\n        show variable [distance v]\n        show variable [converthiscore v]\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\nset [dead? v] to [0]\nforever\n    if <(||LEVEL||) = [11]> then\n        hide\n        broadcast (Dead v)\n        set [dead? v] to [1]\n    end\nend\n\nwhen I receive [start v]\nwait (0.5) seconds\nshow\nset [||level|| v] to [1]\nwait until <(||LEVEL||) = [1]>\ngo to x: (234) y: (-120)\nwait until <(||LEVEL||) = [2]>\ngo to x: (234) y: (-12)\nwait until <(||LEVEL||) = [3]>\ngo to x: (234) y: (-84)\nwait until <(||LEVEL||) = [4]>\ngo to x: (-234) y: (120)\nwait until <(||LEVEL||) = [5]>\ngo to x: (-210) y: (84)\nwait until <(||LEVEL||) = [6]>\ngo to x: (-234) y: (120)\nwait until <(||LEVEL||) = [7]>\ngo to x: (234) y: (72)\nwait until <(||LEVEL||) = [8]>\ngo to x: (234) y: (84)\nwait until <(||LEVEL||) = [9]>\ngo to x: (-234) y: (131)\nwait until <(||LEVEL||) = [10]>\ngo to x: (234) y: (84)\n\n@Lava\n\nwhen flag clicked\nwait (0.001) seconds\nforever\n    if <(||LEVEL||) = [11]> then\n        hide\n        stop [this script v]\n    else\n        go to [front v] layer\n        switch costume to ((||LEVEL||) - (2))\n    end\nend\n\nwhen flag clicked\nwait (0.001) seconds\nhide\nset size to (600) %\ngo to x: (0) y: (0)\nwait until <(||LEVEL||) = [3]>\ngo to x: (0) y: (0)\nshow\nwait until <(||LEVEL||) = [4]>\ngo to x: (0) y: (0)\nwait until <(||LEVEL||) = [5]>\n\n@Spring\n\nwhen I start as a clone\nhide\nforever\n    go to [front v] layer\n    if <(||LEVEL||) = [1]> then\n        hide\n        delete this clone\n    else\n        if <(||LEVEL||) = [5]> then\n            show\n            wait until <(||LEVEL||) = [6]>\n            delete this clone\n        else\n            if <(||LEVEL||) = [6]> then\n                show\n                wait until <(||LEVEL||) = [7]>\n                delete this clone\n            else\n                if <(||LEVEL||) = [7]> then\n                    show\n                    wait until <(||LEVEL||) = [8]>\n                    delete this clone\n                else\n                    if <(||LEVEL||) = [8]> then\n                        show\n                        wait until <(||LEVEL||) = [9]>\n                        delete this clone\n                    else\n                        if <(||LEVEL||) = [9]> then\n                            show\n                            wait until <(||LEVEL||) = [10]>\n                            delete this clone\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\nwait (0.001) seconds\nset size to (300) %\nhide\nwait until <(||LEVEL||) = [5]>\nshow\ngo to x: (18) y: (-54)\ncreate clone of (_myself_ v)\ngo to x: (234) y: (6)\nwait until <(||LEVEL||) = [6]>\ngo to x: (18) y: (78)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nwait until <(||LEVEL||) = [7]>\ngo to x: (6) y: (-67)\nwait until <(||LEVEL||) = [8]>\ngo to x: (150) y: (-90)\nwait until <(||LEVEL||) = [9]>\nhide\n\nwhen flag clicked\nhide\n\n@Fall Block\n\nwhen I start as a clone\nset [vel v] to [-1]\nforever\n    if <(||LEVEL||) = [4]> then\n        show\n        wait until <(||LEVEL||) = [5]>\n        delete this clone\n    else\n        if <(||LEVEL||) = [5]> then\n            show\n            wait until <(||LEVEL||) = [6]>\n            delete this clone\n        else\n            if <(||LEVEL||) = [6]> then\n                show\n                wait until <(||LEVEL||) = [7]>\n                delete this clone\n            else\n                if <(||LEVEL||) = [7]> then\n                    show\n                    wait until <(||LEVEL||) = [8]>\n                    delete this clone\n                else\n                    if <(||LEVEL||) = [8]> then\n                        show\n                        wait until <(||LEVEL||) = [9]>\n                        delete this clone\n                    else\n                        if <(||LEVEL||) = [9]> then\n                            show\n                            wait until <(||LEVEL||) = [10]>\n                            delete this clone\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nwait (0.001) seconds\nhide\nwait until <(||LEVEL||) = [4]>\ngo to x: (91) y: (48)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nwait until <(||LEVEL||) = [5]>\ngo to x: (172) y: (102)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-108)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nwait until <(||LEVEL||) = [6]>\ngo to x: (-78) y: (102)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nchange x by (-12)\ncreate clone of (_myself_ v)\nwait until <(||LEVEL||) = [8]>\ngo to x: (-125) y: (-30)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\nwait until <(||LEVEL||) = [9]>\ngo to x: (30) y: (-90)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\ngo to x: (114) y: (-38)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\ngo to x: (192) y: (10)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\ngo to x: (114) y: (70)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\nchange x by (12)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nshow\nset size to (600) %\nset [x v] to (x position)\nset [y v] to (y position)\nforever\n    if <(distance to [main character v]) < [17]> then\n        wait (0.125) seconds\n        repeat until <touching (_edge_ v)?>\n            change [vel v] by (-0.9)\n            change y by (Vel)\n        end\n        hide\n        wait (2) seconds\n        set [vel v] to [-1]\n        go to x: (X) y: (Y)\n        show\n    else\n        show\n    end\nend\n\n@Terrain\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nforever\n    if <(||LEVEL||) = [11]> then\n        hide\n        stop [this script v]\n    else\n        go to x: (0) y: (0)\n        switch costume to (||LEVEL||)\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\nshow\nset size to (200) %\ngo to x: (0) y: (100)\nclear graphic effects\n\nwhen I receive [start v]\nrepeat (40)\n    change y by (10)\nend\nhide\n\n@Sprite4\n\nwhen flag clicked\nshow\ngo to x: (0) y: (-40)\nclear graphic effects\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume2 v)\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            broadcast (Start v)\n            repeat (40)\n                change y by (10)\n            end\n            hide\n            stop [this script v]\n        end\n    else\n        switch costume to (costume1 v)\n    end\nend\n\n@Sprite5\n\nwhen flag clicked\nhide\n\nwhen I receive [hiscore v]\ngo to x: (0) y: (0)\nshow\nclear graphic effects\nset size to (100) %\nrepeat (25)\n    go to [front v] layer\n    change size by (8)\n    change [ghost v] effect by (4)\nend\n\n@Sprite6\n\nwhen flag clicked\nwait (0.001) seconds\nhide\n\nwhen I receive [dead v]\nshow\ngo to x: (0) y: (0)\ngo [backward v] (99) layers\n\n@Sprite7\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\n@Sprite8\n\nwhen I receive [start v]\nrepeat (40)\n    change y by (10)\nend\nhide\n\nwhen flag clicked\nshow\nset size to (600) %\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n