Portals - a platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (no ban v)\nforever\n    if <(Level) = [7]> then\n        switch backdrop to (ban v)\n    end\nend\n\n@Player\n\nwhen flag clicked\ngo to [front v] layer\nshow\ngo to x: (-200) y: (-60)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    change [y v] by (-0.5)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (player costume v)\n        change [x v] by (0.7)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        switch costume to (player costume v)\n        change [x v] by (-0.7)\n    end\n    set [x v] to ((X) * (0.9))\n    change x by (X)\n    if <key (r v) pressed?> then\n        switch costume to (player costume v)\n        go to x: (-170) y: (-31)\n    end\n    if  then\n        change y by (1)\n        LAVA?\n        change x by (round ((X) * (-1)))\n        LAVA?\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y v] to [7]\n            LAVA?\n            if <(X) > [0]> then\n                set [x v] to [-5]\n                LAVA?\n            else\n                set [x v] to [5]\n                LAVA?\n            end\n        else\n            set [x v] to [0]\n            LAVA?\n        end\n    end\n    change y by (Y)\n    LAVA?\n    if <<touching color (#919191)?> or > then\n        change y by ((Y) * (-1))\n        LAVA?\n        set [y v] to [0]\n        LAVA?\n    end\n    change y by (-0.5)\n    LAVA?\n    if <<<touching color (#919191)?> or <(y position) < [-166]>> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y v] to [8]\n        LAVA?\n    end\n    change y by (0.5)\n    if <touching color (#ffe166)?> then\n        start sound [Boing v]\n        set [y v] to [15]\n    end\n    if <(x position) > [215]> then\n        LAVA?\n        broadcast (Next Level v)\n        go to x: (-200) y: (-60)\n        LAVA?\n        set [time v] to ((timer) + (time))\n        reset timer\n        LAVA?\n    end\n    if <<touching color (#282828)?> or <touching color (#060606)?>> then\n        go to x: (-200) y: (-60)\n        change [deaths v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(Num of Portals) = [2]> and <touching (portals v)?>> then\n        if <touching color (#c2c2c2)?> then\n            go to x: ((Orange Portal X) + ((X) * (2))) y: ((Orange Portal Y) + ((Y) * (2)))\n            broadcast (New Portal Layout v)\n            set [next portal type v] to [Entry]\n            wait (1.2) seconds\n        end\n        if <touching color (#a9a9a9)?> then\n            go to x: ((Blue Portal X) + ((X) * (2))) y: ((Blue Portal Y) + ((Y) * (2)))\n            broadcast (New Portal Layout v)\n            set [next portal type v] to [Entry]\n            wait (1.2) seconds\n        end\n    end\nend\n\nwhen I receive [end game v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\ndefine LAVA?\nif <not <(pick random (1) to (20)) = [1]>> then\n    if <<touching color (#282828)?> or <touching color (#060606)?>> then\n        go to x: (-200) y: (-60)\n        change [deaths v] by (1)\n    end\nend\n\n@Level\n\nwhen flag clicked\nreset timer\nshow\nset [level v] to [1]\ngo to [back v] layer\nset [portals used v] to [0]\nforever\n    switch costume to (Level)\n    if <[11] < (Level)> then\n        broadcast (End Game v)\n    end\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\nwhen I receive [end game v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen [y v] key pressed\nset [level v] to [10]\nswitch backdrop to (no ban v)\nbroadcast (Next Level v)\n\n@Portals\n\nwhen flag clicked\nshow\nset [num of portals v] to [0]\nset [next portal type v] to [Entry]\nswitch costume to (crosshair v)\nforever\n    go to (mouse-pointer v)\nend\n\nwhen flag clicked\nforever\n    if <not <touching color (#4a4a4a)?>> then\n        if <mouse down?> then\n            if <(Next Portal Type) = [Entry]> then\n                Blue Portal Spawn\n                wait (0.2) seconds\n            else\n                Orange Portal Spawn\n                wait (0.2) seconds\n                change [portals used v] by (1)\n            end\n            change [num of portals v] by (1)\n        end\n    end\nend\n\nwhen I receive [new portal layout v]\nset [num of portals v] to [0]\ndelete this clone\n\ndefine Blue Portal Spawn\nbroadcast (New Portal Layout v)\nset [next portal type v] to [Exit]\nset [blue portal x v] to (x position)\nset [blue portal y v] to (y position)\nswitch costume to (entry v)\ncreate clone of (_myself_ v)\nswitch costume to (crosshair v)\n\ndefine Orange Portal Spawn\nset [next portal type v] to [Entry]\nset [orange portal x v] to (x position)\nset [orange portal y v] to (y position)\nswitch costume to (exit v)\ncreate clone of (_myself_ v)\nswitch costume to (crosshair v)\n\nwhen I receive [end game v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [next level v]\nset [num of portals v] to [0]\ndelete this clone\n\n@Coins\n\nwhen flag clicked\nset [coins v] to [0]\nshow\ngo to x: (-107) y: (42)\ncreate clone of (_myself_ v)\ngo to x: (129) y: (40)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        change [coins v] by (1)\n        delete this clone\n    end\nend\n\nwhen I receive [next level v]\nwait (0.1) seconds\nif <(Level) = [1]> then\n    show\n    go to x: (-107) y: (42)\n    create clone of (_myself_ v)\n    go to x: (129) y: (40)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [2]>\nend\nif <(Level) = [2]> then\n    show\n    go to x: (-88) y: (54)\n    create clone of (_myself_ v)\n    go to x: (45) y: (-95)\n    create clone of (_myself_ v)\n    go to x: (13) y: (140)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [3]>\nend\nif <(Level) = [3]> then\n    show\n    go to x: (-64) y: (88)\n    create clone of (_myself_ v)\n    go to x: (96) y: (-93)\n    create clone of (_myself_ v)\n    go to x: (205) y: (72)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [4]>\nend\nif <(Level) = [4]> then\n    show\n    go to x: (35) y: (10)\n    create clone of (_myself_ v)\n    go to x: (-115) y: (111)\n    create clone of (_myself_ v)\n    go to x: (133) y: (152)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [5]>\nend\nif <(Level) = [5]> then\n    show\n    go to x: (56) y: (61)\n    create clone of (_myself_ v)\n    go to x: (4) y: (19)\n    create clone of (_myself_ v)\n    go to x: (-185) y: (149)\n    create clone of (_myself_ v)\n    go to x: (-169) y: (-19)\n    create clone of (_myself_ v)\n    go to x: (211) y: (-59)\n    create clone of (_myself_ v)\n    go to x: (112) y: (108)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [6]>\nend\nif <(Level) = [6]> then\n    show\n    go to x: (-85) y: (42)\n    create clone of (_myself_ v)\n    go to x: (-193) y: (153)\n    create clone of (_myself_ v)\n    go to x: (78) y: (-45)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [6]>\nend\nif <(Level) = [7]> then\n    show\n    go to x: (-107) y: (42)\n    create clone of (_myself_ v)\n    go to x: (129) y: (40)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [8]>\nend\nif <(Level) = [8]> then\n    show\n    go to x: (-88) y: (54)\n    create clone of (_myself_ v)\n    go to x: (45) y: (-95)\n    create clone of (_myself_ v)\n    go to x: (13) y: (150)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [3]>\nend\nif <(Level) = [9]> then\n    show\n    go to x: (-210) y: (-9)\n    create clone of (_myself_ v)\n    go to x: (194) y: (-56)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [10]>\nend\nif <(Level) = [10]> then\n    show\n    go to x: (35) y: (10)\n    create clone of (_myself_ v)\n    go to x: (-145) y: (145)\n    create clone of (_myself_ v)\n    go to x: (133) y: (152)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [11]>\nend\nif <(Level) = [11]> then\n    show\n    go to x: (56) y: (61)\n    create clone of (_myself_ v)\n    go to x: (4) y: (19)\n    create clone of (_myself_ v)\n    go to x: (-180) y: (-19)\n    create clone of (_myself_ v)\n    go to x: (211) y: (-59)\n    create clone of (_myself_ v)\n    go to x: (112) y: (108)\n    create clone of (_myself_ v)\n    hide\n    wait until <(Level) = [12]>\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen I receive [end game v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nwhen I receive [end game v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nhide variable [tp v]\nhide variable [coins v]\nhide variable [portals used v]\nshow\ngo to [front v] layer\nstop [all v]\n\n@End Text\n\nwhen I receive [end game v]\nshow\nshow variable [time v]\nshow variable [show score v]\nshow variable [portals used v]\nshow variable [tp v]\nshow variable [deaths v]\nset [show score v] to (Coins)\nset [tp v] to (((((Show Score) - (portals used)) * (Show Score)) - (deaths)) * (100))\nif <<(time) = [0]> and <(portals used) < [15]>> then\n    set [tp v] to ((tp) + (20000))\n    set [time v] to [20000]\n    stop [this script v]\nend\nif <<[0] < (time)> and <[50] > (time)>> then\n    set [tp v] to ((tp) + (10000))\n    set [time v] to [10000]\n    stop [this script v]\nend\nif <<[50] < (time)> and <[100] > (time)>> then\n    set [tp v] to ((tp) + (5000))\n    set [time v] to [5000]\n    stop [this script v]\nend\nif <<[100] < (time)> and <[200] > (time)>> then\n    set [tp v] to ((tp) + (2500))\n    set [time v] to [2500]\n    stop [this script v]\nend\nif <<[200] < (time)> and <[400] > (time)>> then\n    set [tp v] to ((tp) + (1250))\n    set [time v] to [1250]\n    stop [this script v]\nend\nif <(time) > [400]> then\n    set [tp v] to ((tp) + (750))\n    set [time v] to [750]\n    stop [this script v]\nend\nif <(tp) < [0]> then\n    set [tp v] to (round ([sqrt v] of ([sqrt v] of ((tp) * (tp)) ) ))\nend\n\nwhen flag clicked\nhide\nhide variable [time v]\nset [deaths v] to [0]\nset [time v] to [0]\nhide variable [deaths v]\nhide variable [show score v]\nhide variable [portals used v]\nhide variable [tp v]\n\n
Spam Green Flag\nWASD or Arrow Keys\nClick to use portals \nYour aim collect as many stars using as little portals as possible post your score in the comment\nREAD BEFORE COMMENTING\nMany and I mean MANY people have now told me about the multiple bugs in the game, however I know about these and for the majority of them I decided to keep them since they are fun and cool bugs \nAnd  on that note I have updated the game with some basic bug fixes etc